45 #include <QPushButton>
49 #define YUILogComponent "qt-pkg"
52 #include "YQPkgStatusFilterView.h"
53 #include "YQIconPool.h"
55 #include "QY2LayoutUtils.h"
60 #define SPACING 6 // between subwidgets
61 #define MARGIN 4 // around the widget
65 : QScrollArea( parent )
67 QWidget * content =
new QWidget;
68 QVBoxLayout *layout =
new QVBoxLayout();
69 content->setLayout(layout);
70 layout->setMargin( MARGIN );
71 layout->setSpacing( SPACING );
77 QLabel * label =
new QLabel( _(
"Changes Overview" ),
this );
79 label->setFont( YQUI::ui()->headingFont() );
87 QGroupBox * gbox =
new QGroupBox( _(
"Show packages with status" ), content );
90 QVBoxLayout *box =
new QVBoxLayout;
92 layout->addWidget(gbox);
95 _showInstall =
addStatusCheckBox( gbox, _(
"Install" ), YQIconPool::pkgInstall(),
true );
96 _showUpdate =
addStatusCheckBox( gbox, _(
"Update" ), YQIconPool::pkgUpdate(),
true );
97 _showAutoDel =
addStatusCheckBox( gbox, _(
"Autodelete" ), YQIconPool::pkgAutoDel(),
true );
98 _showAutoInstall =
addStatusCheckBox( gbox, _(
"Autoinstall" ), YQIconPool::pkgAutoInstall(),
true );
99 _showAutoUpdate =
addStatusCheckBox( gbox, _(
"Autoupdate" ), YQIconPool::pkgAutoUpdate(),
true );
100 _showTaboo =
addStatusCheckBox( gbox, _(
"Taboo" ), YQIconPool::pkgTaboo(),
true );
101 _showProtected =
addStatusCheckBox( gbox, _(
"Protected" ), YQIconPool::pkgProtected(),
true );
103 box->addSpacing( 8 );
107 _showKeepInstalled =
addStatusCheckBox( gbox, _(
"Keep" ), YQIconPool::pkgKeepInstalled(),
false );
108 _showNoInst =
addStatusCheckBox( gbox, _(
"Do not install" ), YQIconPool::pkgNoInst(),
false );
110 layout->addStretch();
114 QHBoxLayout *hbox =
new QHBoxLayout();
115 layout->addLayout(hbox);
120 _refreshButton =
new QPushButton( _(
"&Refresh List" ), content );
121 Q_CHECK_PTR( _refreshButton );
122 hbox->addWidget(_refreshButton);
126 connect( _refreshButton, SIGNAL( clicked() ),
127 this, SLOT (
filter() ) );
129 for (
int i=0; i < 6; i++ )
130 layout->addStretch();
132 setWidgetResizable(
true);
146 const QString & text,
147 const QPixmap & icon,
148 bool initiallyChecked )
150 QBoxLayout *layout = dynamic_cast<QBoxLayout*>(parent->layout());
152 QHBoxLayout *hbox =
new QHBoxLayout;
153 layout->addLayout(hbox);
155 QCheckBox * checkBox =
new QCheckBox( text, parent );
156 Q_CHECK_PTR( checkBox );
157 checkBox->setChecked( initiallyChecked );
159 hbox->addWidget(checkBox);
161 QLabel * label =
new QLabel( parent );
162 Q_CHECK_PTR( label );
163 label->setPixmap( icon );
165 hbox->addWidget(label);
167 layout->addStretch();
169 connect( checkBox, SIGNAL( clicked() ),
170 this, SLOT (
filter() ) );
179 return QSize( 0, 0 );
196 for ( ZyppPoolIterator it = zyppPkgBegin();
200 ZyppSel selectable = *it;
203 check( selectable, selectable->candidateObj() ) ||
204 check( selectable, selectable->installedObj() );
210 ! selectable->candidateObj() &&
211 ! selectable->installedObj() )
212 check( selectable, selectable->theObj() );
228 switch ( selectable->status() )
230 case S_AutoDel: match = _showAutoDel->isChecked();
break;
231 case S_AutoInstall: match = _showAutoInstall->isChecked();
break;
232 case S_AutoUpdate: match = _showAutoUpdate->isChecked();
break;
233 case S_Del: match = _showDel->isChecked();
break;
234 case S_Install: match = _showInstall->isChecked();
break;
235 case S_KeepInstalled: match = _showKeepInstalled->isChecked();
break;
236 case S_NoInst: match = _showNoInst->isChecked();
break;
237 case S_Protected: match = _showProtected->isChecked();
break;
238 case S_Taboo: match = _showTaboo->isChecked();
break;
239 case S_Update: match = _showUpdate->isChecked();
break;
247 ZyppPkg zyppPkg = tryCastToZyppPkg( zyppObj );
260 _showDel->setChecked(
false );
261 _showInstall->setChecked(
false );
262 _showUpdate->setChecked(
false );
263 _showAutoDel->setChecked(
false );
264 _showAutoInstall->setChecked(
false );
265 _showAutoUpdate->setChecked(
false );
266 _showTaboo->setChecked(
false );
267 _showProtected->setChecked(
false );
268 _showKeepInstalled->setChecked(
false );
269 _showNoInst->setChecked(
false );
282 _showDel->setChecked(
true );
283 _showInstall->setChecked(
true );
284 _showUpdate->setChecked(
true );
290 _showAutoDel->setChecked(
true );
291 _showAutoInstall->setChecked(
true );
292 _showAutoUpdate->setChecked(
true );
298 _showTaboo->setChecked(
true );
299 _showProtected->setChecked(
true );
305 _showKeepInstalled->setChecked(
true );
311 _showNoInst->setChecked(
true );