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,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::activated),
109 _detailsViews =
new QTabWidget( _splitter ); Q_CHECK_PTR( _detailsViews );
113 _detailsViews->addTab( _descriptionView, _(
"Patch Description" ) );
115 connect( _patchList, SIGNAL( currentItemChanged ( ZyppSel ) ),
116 _descriptionView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
118 connect( _patchList, SIGNAL( statusChanged() ),
134 set<ZyppSel> selectablesToInstall;
138 for ( ZyppPoolIterator patches_it = zyppPatchesBegin();
139 patches_it != zyppPatchesEnd();
142 ZyppPatch patch = tryCastToZyppPatch( (*patches_it)->theObj() );
146 ZyppPatchContents patchContents( patch->contents() );
148 for ( ZyppPatchContentsIterator contents_it = patchContents.begin();
149 contents_it != patchContents.end();
152 ZyppPkg pkg = zypp::make<zypp::Package>(*contents_it);
160 switch ( sel->status() )
171 selectablesToInstall.insert( sel );
177 case S_KeepInstalled:
194 for ( set<ZyppSel>::iterator it = selectablesToInstall.begin();
195 it != selectablesToInstall.end();
198 if ( (*it)->candidateObj() )
199 totalSize += (*it)->candidateObj()->installSize();
202 #if ENABLE_TOTAL_DOWNLOAD_SIZE 203 _totalDownloadSize->setText( totalSize.asString().c_str() );
206 yuiDebug() <<
"Calculated total download size in " 207 << calcTime.elapsed() <<
" millisec" 215 switch ( _patchFilter->currentIndex() )
218 case 1: _patchList->
setFilterCriteria( YQPkgPatchList::RelevantAndInstalledPatches );
break;
220 default: _patchList->
setFilterCriteria( YQPkgPatchList::RelevantPatches );
break;
224 _patchList->selectSomething();
228 #include "YQPkgPatchFilterView.moc" Display the description of a ZyppObj derived object along with its name and summary.
void fillPatchList()
Fill the patch list with regard to the _patchCategory combo box.
Display a list of zypp::Patch objects.
void fillList()
Fill the patch list according to filterCriteria().
YQPkgPatchFilterView(QWidget *parent)
Constructor.
virtual ~YQPkgPatchFilterView()
Destructor.
ZyppSel findZyppSel(ZyppPkg pkg)
Find the corresponding ZyppSel to a ZyppPkg.
void updateTotalDownloadSize()
Update the "total download size" field.
void setFilterCriteria(FilterCriteria filterCriteria)
Set the filter criteria for fillList().