42 #define YUILogComponent "qt-pkg"
51 #include <QVBoxLayout>
54 #include <zypp/Patch.h>
56 #include "YQPkgPatchFilterView.h"
57 #include "YQPkgPatchList.h"
58 #include "YQPkgDescriptionView.h"
59 #include "QY2LayoutUtils.h"
62 typedef zypp::Patch::Contents ZyppPatchContents;
63 typedef zypp::Patch::Contents::const_iterator ZyppPatchContentsIterator;
68 #define ENABLE_TOTAL_DOWNLOAD_SIZE 0
73 QVBoxLayout *layout =
new QVBoxLayout();
74 layout->setContentsMargins(0,0,0,0);
77 _splitter =
new QSplitter( Qt::Vertical,
this ); Q_CHECK_PTR( _splitter );
78 layout->addWidget(_splitter);
80 QWidget *upper_box =
new QWidget( _splitter );
81 QVBoxLayout *vbox =
new QVBoxLayout( upper_box );
83 Q_CHECK_PTR( _patchList );
85 vbox->addWidget( _patchList );
87 QHBoxLayout * hbox =
new QHBoxLayout(); Q_CHECK_PTR( hbox );
88 vbox->addLayout(hbox);
89 vbox->setContentsMargins(0,0,0,0);
92 QLabel * label =
new QLabel( _(
"&Show Patch Category:" ), upper_box );
93 hbox->addWidget(label);
95 _patchFilter =
new QComboBox( upper_box );
96 Q_CHECK_PTR( _patchFilter );
97 hbox->addWidget(_patchFilter);
99 _patchFilter->addItem( _(
"Needed Patches" ));
100 _patchFilter->addItem( _(
"Unneeded Patches" ));
101 _patchFilter->addItem( _(
"All Patches" ), 2 );
102 _patchFilter->setCurrentIndex( 0 );
104 label->setBuddy( _patchFilter );
106 connect( _patchFilter, SIGNAL( activated(
int ) ),
this, SLOT(
fillPatchList() ) );
108 _detailsViews =
new QTabWidget( _splitter ); Q_CHECK_PTR( _detailsViews );
112 _detailsViews->addTab( _descriptionView, _(
"Patch Description" ) );
114 connect( _patchList, SIGNAL( currentItemChanged ( ZyppSel ) ),
115 _descriptionView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
117 connect( _patchList, SIGNAL( statusChanged() ),
133 set<ZyppSel> selectablesToInstall;
137 for ( ZyppPoolIterator patches_it = zyppPatchesBegin();
138 patches_it != zyppPatchesEnd();
141 ZyppPatch patch = tryCastToZyppPatch( (*patches_it)->theObj() );
145 ZyppPatchContents patchContents( patch->contents() );
147 for ( ZyppPatchContentsIterator contents_it = patchContents.begin();
148 contents_it != patchContents.end();
151 ZyppPkg pkg = zypp::make<zypp::Package>(*contents_it);
159 switch ( sel->status() )
170 selectablesToInstall.insert( sel );
176 case S_KeepInstalled:
193 for ( set<ZyppSel>::iterator it = selectablesToInstall.begin();
194 it != selectablesToInstall.end();
197 if ( (*it)->candidateObj() )
198 totalSize += (*it)->candidateObj()->installSize();
201 #if ENABLE_TOTAL_DOWNLOAD_SIZE
202 _totalDownloadSize->setText( totalSize.asString().c_str() );
205 yuiDebug() <<
"Calculated total download size in "
206 << calcTime.elapsed() <<
" millisec"
214 switch ( _patchFilter->currentIndex() )
217 case 1: _patchList->
setFilterCriteria( YQPkgPatchList::RelevantAndInstalledPatches );
break;
219 default: _patchList->
setFilterCriteria( YQPkgPatchList::RelevantPatches );
break;
223 _patchList->selectSomething();
227 #include "YQPkgPatchFilterView.moc"
Display the description of a ZyppObj derived object along with its name and summary.
Display a list of zypp::Patch objects.
YQPkgPatchFilterView(QWidget *parent)
virtual ~YQPkgPatchFilterView()
ZyppSel findZyppSel(ZyppPkg pkg)
void updateTotalDownloadSize()
void setFilterCriteria(FilterCriteria filterCriteria)