42 #include <QApplication>
44 #include <QHeaderView>
45 #include <QPushButton>
48 #define YUILogComponent "qt-pkg"
51 #include "QY2LayoutUtils.h"
53 #include "YQSimplePatchSelector.h"
54 #include "YQPkgConflictDialog.h"
55 #include "YQPkgDiskUsageList.h"
56 #include "YQPkgPatchFilterView.h"
57 #include "YQPkgPatchList.h"
71 #define SHOW_DISK_USAGE 0
78 YQSimplePatchSelector::YQSimplePatchSelector( YWidget * parent,
long modeFlags )
84 _wizard = findWizard();
90 _patchList->fillList();
91 _patchList->selectSomething();
95 _diskUsageList->updateDiskUsage();
103 YQWizard * wizard = 0;
105 YQDialog * dialog =
dynamic_cast<YQDialog *
> ( YDialog::currentDialog() );
108 wizard = dialog->findWizard();
116 YQSimplePatchSelector::basicLayout()
118 QSplitter * splitter =
new QSplitter( Qt::Vertical,
this );
119 Q_CHECK_PTR( splitter );
121 setLayout(
new QVBoxLayout( ) );
122 layout()->addWidget(splitter);
128 QBoxLayout *layout =
new QVBoxLayout;
129 layout->setMargin( MARGIN );
130 QWidget * upper_vbox =
new QWidget( splitter );
131 Q_CHECK_PTR( upper_vbox );
132 upper_vbox->setLayout(layout);
133 splitter->addWidget(upper_vbox);
135 splitter->setStretchFactor( 0, 1 );
138 layout->addWidget( _patchFilterView );
139 Q_CHECK_PTR( _patchFilterView );
141 _patchList = _patchFilterView->
patchList();
142 Q_CHECK_PTR( _patchList );
152 layout =
new QVBoxLayout;
153 QWidget * lower_vbox =
new QWidget( splitter );
154 lower_vbox->setLayout(layout);
156 Q_CHECK_PTR( lower_vbox );
160 Q_CHECK_PTR( _diskUsageList );
161 layout->addWidget(_diskUsageList);
163 splitter->setResizeMode( lower_vbox, QSplitter::FollowSizeHint );
178 layout =
new QHBoxLayout;
179 QWidget * hbox =
new QWidget(
this );
181 hbox->setLayout(layout);
182 QPushButton * details_button =
new QPushButton( _(
"&Details..." ), hbox );
183 layout->addWidget(details_button);
184 Q_CHECK_PTR( details_button );
186 connect( details_button, SIGNAL( clicked() ),
193 layoutButtons(
this );
199 YQSimplePatchSelector::layoutButtons( QWidget * parent )
201 QWidget * button_box =
new QWidget( parent );
202 QHBoxLayout *layout =
new QHBoxLayout( button_box );
203 Q_CHECK_PTR( button_box );
204 layout->setMargin ( MARGIN );
205 layout->setSpacing( SPACING );
208 QPushButton * details_button =
new QPushButton( _(
"&Details..." ), button_box );
209 Q_CHECK_PTR( details_button );
210 layout->addWidget(details_button);
211 details_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
213 connect( details_button, SIGNAL( clicked() ),
217 layout->addStretch();
219 QPushButton * cancel_button =
new QPushButton( _(
"&Cancel" ), button_box );
220 Q_CHECK_PTR( cancel_button );
221 layout->addWidget(cancel_button);
222 cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
224 connect( cancel_button, SIGNAL( clicked() ),
225 this, SLOT (
reject() ) );
228 QPushButton * accept_button =
new QPushButton( _(
"&Accept" ), button_box );
229 Q_CHECK_PTR( accept_button );
230 layout->addWidget(accept_button);
231 accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
233 connect( accept_button, SIGNAL( clicked() ),
234 this, SLOT (
accept() ) );
236 this->layout()->addWidget( button_box );
245 if ( _patchList && _diskUsageList )
247 connect( _patchList, SIGNAL( updatePackages() ),
248 _diskUsageList, SLOT ( updateDiskUsage() ) );
251 yuiMilestone() <<
"Connection set up" << endl;
255 connect( _wizard, SIGNAL( nextClicked() ),
256 this, SLOT (
accept() ) );
258 connect( _wizard, SIGNAL( backClicked() ),
259 this, SLOT (
reject() ) );
261 connect( _wizard, SIGNAL( abortClicked() ),
262 this, SLOT (
reject() ) );
270 yuiMilestone() <<
"\"Details..\" button clicked" << endl;
271 YQUI::ui()->sendEvent(
new YMenuEvent(
"details" ) );
278 yuiWarning() <<
"debugTrace" << endl;
283 #include "YQSimplePatchSelector.moc"