1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgTechnicalDetailsView.cc
15 Author: Stefan Hundhammer <sh@suse.de>
17 Textdomain "packages-qt"
21 #define y2log_component "qt-pkg"
22 #include <ycp/y2log.h>
24 #include "YQPkgTechnicalDetailsView.h"
34 YQPkgTechnicalDetailsView::YQPkgTechnicalDetailsView( QWidget * parent )
35 : YQPkgGenericDetailsView( parent )
40 YQPkgTechnicalDetailsView::~YQPkgTechnicalDetailsView()
47 YQPkgTechnicalDetailsView::showDetails( ZyppSel selectable )
49 _selectable = selectable;
57 QString html_text = htmlHeading( selectable );
59 ZyppPkg candidate = tryCastToZyppPkg( selectable->candidateObj() );
60 ZyppPkg installed = tryCastToZyppPkg( selectable->installedObj() );
62 if ( candidate && installed && candidate != installed )
64 html_text += complexTable( selectable, installed, candidate );
69 html_text += simpleTable( selectable, candidate );
72 html_text += simpleTable( selectable, installed );
80 YQPkgTechnicalDetailsView::authorsListCell( ZyppPkg pkg ) const
82 QString html = "<td align=top>";
84 list<string> authors = pkg->authors();
85 list<string>::const_iterator it = authors.begin();
87 while ( it != authors.end() )
89 line = fromUTF8( *it );
90 line = htmlEscape( line );
91 html += line + "<br>";
102 YQPkgTechnicalDetailsView::formatRpmGroup( ZyppPkg pkg ) const
104 QStringList groups = fromUTF8( pkg->group() ).split( '/', QString::KeepEmptyParts );
106 // Translate group path components
108 QStringList translated;
110 for ( QStringList::const_iterator it = groups.begin();
114 translated.append( QString::fromUtf8( dgettext( "rpm-groups", (*it).toUtf8() ) ) );
117 return translated.join( "/" );
122 YQPkgTechnicalDetailsView::simpleTable( ZyppSel selectable,
127 html += row( hcell( _( "Version:" ) ) + cell( pkg->edition().asString() ) );
128 html += row( hcell( _( "Build Time:" ) ) + cell( pkg->buildtime() ) );
131 pkg == selectable->installedObj() ?
132 row( hcell( _( "Install Time:" ) ) + cell( pkg->installtime() ) ) : "";
134 html += row( hcell( _( "Package Group:" ) ) + cell( formatRpmGroup( pkg ) ) );
135 html += row( hcell( _( "License:" ) ) + cell( pkg->license() ) );
136 html += row( hcell( _( "Installed Size:" ) ) + cell( pkg->size().asString() ) );
137 html += row( hcell( _( "Download Size:" ) ) + cell( pkg->downloadSize().asString() ) );
138 html += row( hcell( _( "Distribution:" ) ) + cell( pkg->distribution() ) );
139 html += row( hcell( _( "Vendor:" ) ) + cell( pkg->vendor() ) );
140 html += row( hcell( _( "Packager:" ) ) + cell( pkg->packager() ) );
141 html += row( hcell( _( "Architecture:" ) ) + cell( pkg->arch().asString() ) );
142 html += row( hcell( _( "OS:" ) ) + cell( pkg->os() ) );
143 html += row( hcell( _( "Build Host:" ) ) + cell( pkg->buildhost() ) );
144 html += row( hcell( _( "URL:" ) ) + cell( pkg->url() ) );
146 #ifdef FIXME_missing_in_zypp
147 html += row( hcell( _( "Source RPM:" ) ) + cell( pkg->sourceloc() ) );
149 html += row( hcell( _( "Media No.:" ) ) + cell( pkg->mediaNr() ) );
150 html += row( hcell( _( "Authors:" ) ) + authorsListCell( pkg ) );
152 html = "<br>" + table( html );
159 YQPkgTechnicalDetailsView::complexTable( ZyppSel selectable,
163 ZyppPkg p1 = candidate;
164 ZyppPkg p2 = installed;
166 QString p1_header = _( "<b>Alternate Version</b>" );
167 QString p2_header = _( "<b>Installed Version</b>" );
171 html += row( hcell( QString( "" ) ) + hcell( "<b>" + p1_header + "</b>" ) + hcell( "<b>" + p2_header + "</b>" ) );
173 html += row( hcell( _( "Version:" ) ) + cell( p1->edition().asString() ) + cell( p2->edition().asString() ) );
174 html += row( hcell( _( "Build Time:" ) ) + cell( p1->buildtime() ) + cell( p2->buildtime() ) );
175 html += row( hcell( _( "Install Time:" ) ) + cell( p1->installtime() ) + cell( p2->installtime() ) );
176 html += row( hcell( _( "Package Group:" ) ) + cell( formatRpmGroup( p1 ) ) + cell( formatRpmGroup( p2 ) ) );
177 html += row( hcell( _( "License:" ) ) + cell( p1->license() ) + cell( p2->license() ) );
178 html += row( hcell( _( "Installed Size:" ) ) + cell( p1->size().asString() ) + cell( p2->size().asString() ) );
179 html += row( hcell( _( "Download Size:" ) ) + cell( p1->downloadSize().asString() ) + cell( p2->downloadSize().asString() ) );
180 html += row( hcell( _( "Distribution:" ) ) + cell( p1->distribution() ) + cell( p2->distribution() ) );
181 html += row( hcell( _( "Vendor:" ) ) + cell( p1->vendor() ) + cell( p2->vendor() ) );
182 html += row( hcell( _( "Packager:" ) ) + cell( p1->packager() ) + cell( p2->packager() ) );
183 html += row( hcell( _( "Architecture:" ) ) + cell( p1->arch().asString() ) + cell( p2->arch().asString() ) );
184 html += row( hcell( _( "OS:" ) ) + cell( p1->os() ) + cell( p2->os() ) );
185 html += row( hcell( _( "Build Host:" ) ) + cell( p1->buildhost() ) + cell( p2->buildhost() ) );
186 html += row( hcell( _( "URL:" ) ) + cell( p1->url() ) + cell( p2->url() ) );
187 #ifdef FIXME_missing_in_zypp
188 html += row( hcell( _( "Source RPM:" ) ) + cell( p1->sourceloc() ) + cell( p2->sourceloc() ) );
190 html += row( hcell( _( "Media No.:" ) ) + cell( p1->mediaNr() ) + cell( p2->mediaNr() ) );
191 html += row( hcell( _( "Authors:" ) ) + authorsListCell( p1 ) + authorsListCell( p2 ) );
194 html = "<br>" + table( html );
200 #include "YQPkgTechnicalDetailsView.moc"