40 #define YUILogComponent "qt-pkg"
46 #include "YQPkgGenericDetailsView.h"
54 : QTextBrowser( parent )
57 _parentTab =
dynamic_cast<QTabWidget *
> (parent);
61 connect( parent, SIGNAL( currentChanged(QWidget *) ),
62 this, SLOT (
reload (QWidget *) ) );
67 "{text-align: center;"
68 "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif ;"
69 "font-weight: normal;"
72 + QApplication::palette().color( QPalette::Active, QPalette::Base).name() +
77 "border-collapse: collapse;"
78 "border-spacing: 4px;}"
83 + QApplication::palette().color( QPalette::Active, QPalette::WindowText).name() +
88 + QApplication::palette().color( QPalette::Active, QPalette::Base).name() +
94 + QApplication::palette().color( QPalette::Active, QPalette::Base).name() +
99 + QApplication::palette().color( QPalette::Active, QPalette::Base).name() +
102 "font-weight: bold;} ";
104 document()->addResource( QTextDocument::StyleSheetResource, QUrl(
"format.css" ), css );
117 if ( newCurrent ==
this )
127 _selectable = selectable;
131 if ( _parentTab->currentWidget() == this )
146 return QSize( 0, 0 );
153 return "<html><head>"
154 "<link rel='stylesheet' type='text/css' href='format.css'>"
159 YQPkgGenericDetailsView::htmlEnd()
161 return "</body></html>";
171 ZyppObj zyppObj = selectable->theObj();
176 QString summary = fromUTF8( zyppObj->summary() );
178 QString html =
"<table";
180 if ( ! YQUI::ui()->usingVisionImpairedPalette() )
181 html +=
" class=\"stats\"";
183 html +=
"><tr><td><b>"
184 + fromUTF8( zyppObj->name() )
188 html += QString(
"<b>-" ) + zyppObj->edition().asString().c_str() +
"</b>";
190 if ( ! summary.isEmpty() )
191 html +=
" - " + summary;
193 html +=
"</td></tr></table>";
203 QString html = plainText;
206 html.replace( QRegExp(
"&" ),
"&" );
207 html.replace( QRegExp(
"<" ),
"<" );
208 html.replace( QRegExp(
">" ),
">" );
217 QString html =
"<table";
218 if ( ! YQUI::ui()->usingVisionImpairedPalette() )
219 html +=
" class=\"stats\"";
221 html +=
">" + contents +
"</table>";
230 return "<tr>" + contents +
"</tr>";
238 return "<td>" + contents +
"</td>";
246 html.sprintf(
"<td>%d</td>", contents );
255 return cell( ( (time_t) date == (time_t) 0 ?
"" : date.asString() ) );
262 return cell( fromUTF8( contents ) );
272 QString html =
"<td";
274 if ( ! YQUI::ui()->usingVisionImpairedPalette() )
275 html +=
" bgcolor=\""
276 + QApplication::palette().color( QPalette::Active, QPalette::Window).name()
279 html +=
">" + contents +
"</td>";
285 #include "YQPkgGenericDetailsView.moc"
static QString hcell(QString contents)
static QString htmlHeading(ZyppSel selectable, bool showVersion=false)
static QString cell(QString contents)
virtual void showDetails(ZyppSel selectable)=0
static QString htmlEscape(const QString &plainText)
void reload(QWidget *newCurrent)
void showDetailsIfVisible(ZyppSel selectable)
virtual QSize minimumSizeHint() const
static QString table(const QString &contents)
virtual ~YQPkgGenericDetailsView()
static QString row(const QString &contents)
static QString htmlStart()
YQPkgGenericDetailsView(QWidget *parent)