1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgTechnicalDetailsView.cc
15 Author: Stefan Hundhammer <sh@suse.de>
17 Textdomain "packages-qt"
23 #define y2log_component "qt-pkg"
24 #include <ycp/y2log.h>
26 #include "YQPkgTechnicalDetailsView.h"
30 #include <q3valuelist.h>
36 YQPkgTechnicalDetailsView::YQPkgTechnicalDetailsView( QWidget * parent )
37 : YQPkgGenericDetailsView( parent )
42 YQPkgTechnicalDetailsView::~YQPkgTechnicalDetailsView()
49 YQPkgTechnicalDetailsView::showDetails( ZyppSel selectable )
51 _selectable = selectable;
59 QString html_text = htmlHeading( selectable );
61 ZyppPkg candidate = tryCastToZyppPkg( selectable->candidateObj() );
62 ZyppPkg installed = tryCastToZyppPkg( selectable->installedObj() );
64 if ( candidate && installed && candidate != installed )
66 html_text += complexTable( selectable, installed, candidate );
71 html_text += simpleTable( selectable, candidate );
74 html_text += simpleTable( selectable, installed );
77 setTextFormat( Qt::RichText );
83 YQPkgTechnicalDetailsView::authorsListCell( ZyppPkg pkg ) const
85 QString html = "<td align=top>";
87 list<string> authors = pkg->authors();
88 list<string>::const_iterator it = authors.begin();
90 while ( it != authors.end() )
92 line = fromUTF8( *it );
93 line = htmlEscape( line );
94 html += line + "<br>";
105 YQPkgTechnicalDetailsView::formatRpmGroup( ZyppPkg pkg ) const
107 QStringList groups = fromUTF8( pkg->group() ).split( '/', QString::KeepEmptyParts );
109 // Translate group path components
111 QStringList translated;
113 for ( QStringList::const_iterator it = groups.begin();
117 translated.append( QString::fromUtf8( dgettext( "rpm-groups", (*it).utf8() ) ) );
120 return translated.join( "/" );
125 YQPkgTechnicalDetailsView::simpleTable( ZyppSel selectable,
130 html += row( hcell( _( "Version:" ) ) + cell( pkg->edition().asString() ) );
131 html += row( hcell( _( "Build Time:" ) ) + cell( pkg->buildtime() ) );
134 pkg == selectable->installedObj() ?
135 row( hcell( _( "Install Time:" ) ) + cell( pkg->installtime() ) ) : "";
137 html += row( hcell( _( "Package Group:" ) ) + cell( formatRpmGroup( pkg ) ) );
138 html += row( hcell( _( "License:" ) ) + cell( pkg->license() ) );
139 html += row( hcell( _( "Installed Size:" ) ) + cell( pkg->size().asString() ) );
140 html += row( hcell( _( "Download Size:" ) ) + cell( pkg->downloadSize().asString() ) );
141 html += row( hcell( _( "Distribution:" ) ) + cell( pkg->distribution() ) );
142 html += row( hcell( _( "Vendor:" ) ) + cell( pkg->vendor() ) );
143 html += row( hcell( _( "Packager:" ) ) + cell( pkg->packager() ) );
144 html += row( hcell( _( "Architecture:" ) ) + cell( pkg->arch().asString() ) );
145 html += row( hcell( _( "OS:" ) ) + cell( pkg->os() ) );
146 html += row( hcell( _( "Build Host:" ) ) + cell( pkg->buildhost() ) );
147 html += row( hcell( _( "URL:" ) ) + cell( pkg->url() ) );
149 #ifdef FIXME_missing_in_zypp
150 html += row( hcell( _( "Source RPM:" ) ) + cell( pkg->sourceloc() ) );
152 html += row( hcell( _( "Media No.:" ) ) + cell( pkg->mediaNr() ) );
153 html += row( hcell( _( "Authors:" ) ) + authorsListCell( pkg ) );
155 html = "<br>" + table( html );
162 YQPkgTechnicalDetailsView::complexTable( ZyppSel selectable,
166 ZyppPkg p1 = candidate;
167 ZyppPkg p2 = installed;
169 QString p1_header = _( "<b>Alternate Version</b>" );
170 QString p2_header = _( "<b>Installed Version</b>" );
174 html += row( hcell( QString( "" ) ) + hcell( "<b>" + p1_header + "</b>" ) + hcell( "<b>" + p2_header + "</b>" ) );
176 html += row( hcell( _( "Version:" ) ) + cell( p1->edition().asString() ) + cell( p2->edition().asString() ) );
177 html += row( hcell( _( "Build Time:" ) ) + cell( p1->buildtime() ) + cell( p2->buildtime() ) );
178 html += row( hcell( _( "Install Time:" ) ) + cell( p1->installtime() ) + cell( p2->installtime() ) );
179 html += row( hcell( _( "Package Group:" ) ) + cell( formatRpmGroup( p1 ) ) + cell( formatRpmGroup( p2 ) ) );
180 html += row( hcell( _( "License:" ) ) + cell( p1->license() ) + cell( p2->license() ) );
181 html += row( hcell( _( "Installed Size:" ) ) + cell( p1->size().asString() ) + cell( p2->size().asString() ) );
182 html += row( hcell( _( "Download Size:" ) ) + cell( p1->downloadSize().asString() ) + cell( p2->downloadSize().asString() ) );
183 html += row( hcell( _( "Distribution:" ) ) + cell( p1->distribution() ) + cell( p2->distribution() ) );
184 html += row( hcell( _( "Vendor:" ) ) + cell( p1->vendor() ) + cell( p2->vendor() ) );
185 html += row( hcell( _( "Packager:" ) ) + cell( p1->packager() ) + cell( p2->packager() ) );
186 html += row( hcell( _( "Architecture:" ) ) + cell( p1->arch().asString() ) + cell( p2->arch().asString() ) );
187 html += row( hcell( _( "OS:" ) ) + cell( p1->os() ) + cell( p2->os() ) );
188 html += row( hcell( _( "Build Host:" ) ) + cell( p1->buildhost() ) + cell( p2->buildhost() ) );
189 html += row( hcell( _( "URL:" ) ) + cell( p1->url() ) + cell( p2->url() ) );
190 #ifdef FIXME_missing_in_zypp
191 html += row( hcell( _( "Source RPM:" ) ) + cell( p1->sourceloc() ) + cell( p2->sourceloc() ) );
193 html += row( hcell( _( "Media No.:" ) ) + cell( p1->mediaNr() ) + cell( p2->mediaNr() ) );
194 html += row( hcell( _( "Authors:" ) ) + authorsListCell( p1 ) + authorsListCell( p2 ) );
197 html = "<br>" + table( html );
203 #include "YQPkgTechnicalDetailsView.moc"