42 #define YUILogComponent "qt-pkg"
45 #include <QApplication>
46 #include <QtGui/qdesktopwidget.h>
47 #include <QHBoxLayout>
50 #include <QPushButton>
57 #include "YQPkgProductDialog.h"
58 #include "YQPkgProductList.h"
59 #include "YQPkgDependenciesView.h"
60 #include "QY2LayoutUtils.h"
65 #define SPACING 2 // between subwidgets
66 #define MARGIN 4 // around the widget
73 setWindowTitle( _(
"Products" ) );
76 setSizeGripEnabled(
true );
80 QVBoxLayout * layout =
new QVBoxLayout();
81 Q_CHECK_PTR( layout );
83 layout->setSpacing( SPACING );
84 layout->setMargin ( MARGIN );
88 QSplitter * splitter =
new QSplitter( Qt::Vertical,
this );
89 Q_CHECK_PTR( splitter );
90 layout->addWidget( splitter );
91 layout->setMargin( MARGIN );
97 Q_CHECK_PTR( _productList );
98 _productList->resize( _productList->width(), 80 );
106 _detailsViews =
new QTabWidget( splitter );
107 Q_CHECK_PTR( _detailsViews );
109 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
114 Q_CHECK_PTR( _dependenciesView );
115 _detailsViews->addTab( _dependenciesView, _(
"Dependencies" ) );
116 _dependenciesView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
118 connect( _productList, SIGNAL( currentItemChanged ( ZyppSel ) ),
119 _dependenciesView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
124 QHBoxLayout * hbox =
new QHBoxLayout();
126 hbox->setSpacing( SPACING );
127 hbox->setMargin ( MARGIN );
128 layout->addLayout( hbox );
135 QPushButton * button =
new QPushButton( _(
"&OK" ),
this );
136 hbox->addWidget(button);
137 Q_CHECK_PTR( button );
138 button->setDefault(
true );
140 connect( button, SIGNAL( clicked() ),
141 this, SLOT ( accept() ) );
155 _productList->selectSomething();
162 QRect available = qApp->desktop()->availableGeometry( (QWidget *)
this );
163 QSize size = QDialog::sizeHint();
164 size = size.boundedTo( QSize( available.width(), available.height() ) );
180 #include "YQPkgProductDialog.moc"