42 #define YUILogComponent "qt-pkg" 45 #include <zypp/ZYppFactory.h> 46 #include <zypp/Resolver.h> 52 #include <QPushButton> 55 #include <QMessageBox> 56 #include <QDesktopWidget> 60 #include "YQPkgConflictDialog.h" 61 #include "YQPkgConflictList.h" 64 #include "QY2LayoutUtils.h" 70 #define SPACING 6 // between subwidgets 71 #define MARGIN 4 // around the widget 78 #define SUPPRESS_BUSY_DIALOG_SECONDS 1.5 85 setStyleSheet( QString::null );
88 _totalSolveTime = 0.0;
98 setWindowTitle( _(
"Warning" ) );
101 setSizeGripEnabled(
true );
106 QVBoxLayout * layout =
new QVBoxLayout();
108 layout->setMargin(MARGIN);
109 layout->setSpacing(SPACING);
111 Q_CHECK_PTR( layout );
116 Q_CHECK_PTR( _conflictList );
117 layout->addWidget( _conflictList );
118 layout->addSpacing( 2 );
125 QHBoxLayout * buttonBox =
new QHBoxLayout();
126 Q_CHECK_PTR( buttonBox );
127 buttonBox->setSpacing( SPACING );
128 buttonBox->setMargin ( MARGIN );
129 layout->addLayout( buttonBox );
130 buttonBox->addStretch();
134 QPushButton * button =
new QPushButton( _(
"&OK -- Try Again" ),
this);
135 buttonBox->addWidget(button);
136 Q_CHECK_PTR( button );
137 button->setDefault(
true );
139 connect( button, SIGNAL( clicked() ),
145 button =
new QPushButton( _(
"&Expert" ),
this );
146 buttonBox->addWidget(button);
148 Q_CHECK_PTR( button );
153 _expertMenu =
new QMenu( button );
154 Q_CHECK_PTR( _expertMenu );
155 button->setMenu( _expertMenu );
157 _expertMenu->addAction( _(
"&Save This List to a File..." ),
158 _conflictList, SLOT( askSaveToFile() ) );
163 button =
new QPushButton( _(
"&Cancel" ),
this);
164 buttonBox->addWidget(button);
165 Q_CHECK_PTR( button );
167 connect( button, SIGNAL( clicked() ),
168 this, SLOT ( reject() ) );
169 buttonBox->addStretch();
174 _busyPopup =
new QLabel(
" " + _(
"Checking Dependencies..." ) +
" ", parent, 0
176 , WStyle_Customize | WStyle_DialogBorder | WStyle_Dialog | WStyle_Title
179 Q_CHECK_PTR( _busyPopup );
181 _busyPopup->setWindowTitle(
"" );
182 _busyPopup->resize( _busyPopup->sizeHint() );
183 YQDialog::center( _busyPopup, parent );
206 QSize size = _busyPopup->sizeHint();
207 QPixmap pixmap( 3 * size.width(), 3 * size.height() );
215 QPainter painter( &pixmap );
216 painter.drawText( pixmap.rect(), Qt::AlignLeft | Qt::AlignTop, _busyPopup->text() );
227 _busyPopup->setText(
"" );
231 _busyPopup->setFixedSize( _busyPopup->size() );
244 return limitToScreenSize(
this, 550, 450 );
253 yuiDebug() <<
"Solving..." << endl;
259 bool success = zypp::getZYpp()->resolver()->resolvePool();
261 _totalSolveTime += solveTime.elapsed() / 1000.0;
263 yuiDebug() <<
"Solving done in " << ( solveTime.elapsed() / 1000.0 )
276 yuiDebug() <<
"Verifying system..." << endl;
280 bool success = zypp::getZYpp()->resolver()->verifySystem();
282 yuiDebug() <<
"System verified in " << solveTime.elapsed() / 1000.0 <<
" s" << endl;
291 Q_CHECK_PTR( _conflictList );
292 YQUI::ui()->busyCursor();
307 _conflictList->clear();
309 if ( _solveCount++ == 0 ||
averageSolveTime() > SUPPRESS_BUSY_DIALOG_SECONDS )
311 YQDialog::center( _busyPopup, parentWidget() );
322 qApp->processEvents();
330 if ( _busyPopup->isVisible() )
337 YQUI::ui()->normalCursor();
338 int result = QDialog::Accepted;
342 result = QDialog::Accepted;
349 yuiDebug() <<
"Dependency conflict!" << endl;
350 YQUI::ui()->busyCursor();
352 _conflictList->
fill( zypp::getZYpp()->resolver()->problems() );
353 YQUI::ui()->normalCursor();
369 zypp::getZYpp()->resolver()->undo();
376 if ( _solveCount < 1 )
379 return _totalSolveTime / _solveCount;
386 QString testCaseDir =
"/var/log/YaST2/solverTestcase";
388 QString heading = QString(
"<h2>%1</h2>" ).arg( _(
"Create Dependency Resolver Test Case" ) );
391 _(
"<p>Use this to generate extensive logs to help tracking down bugs in the dependency resolver. " 392 "The logs will be stored in directory <br><tt>%1</tt></p>" ).arg( testCaseDir );
394 int button_no = QMessageBox::information( 0,
395 _(
"Solver Test Case" ),
400 if ( button_no == 1 )
403 yuiMilestone() <<
"Generating solver test case START" << endl;
404 bool success = zypp::getZYpp()->resolver()->createSolverTestcase( qPrintable( testCaseDir ) );
405 yuiMilestone() <<
"Generating solver test case END" << endl;
410 _(
"<p>Dependency resolver test case written to <br><tt>%1</tt></p>" 411 "<p>Prepare <tt>y2logs.tgz tar</tt> archive to attach to Bugzilla?</p>" ).arg( testCaseDir ),
412 button_no = QMessageBox::question( 0,
415 QMessageBox::Yes | QMessageBox::Default,
417 QMessageBox::Cancel | QMessageBox::Escape );
419 if ( button_no & QMessageBox::Yes )
420 YQUI::ui()->askSaveLogs();
424 QMessageBox::warning( 0,
426 _(
"<p><b>Error</b> creating dependency resolver test case</p>" 427 "<p>Please check disk space and permissions for <tt>%1</tt></p>" ).arg( testCaseDir ),
428 QMessageBox::Ok | QMessageBox::Default,
429 QMessageBox::NoButton,
430 QMessageBox::NoButton );
437 if ( event && event->key() == Qt::Key_Print )
439 YQUI::ui()->makeScreenShot(
"" );
442 QWidget::keyPressEvent( event );
447 #include "YQPkgConflictDialog.moc" void updatePackages()
Update package states - they may have changed.
int processSolverResult(bool success)
Process the result of solving: Post conflict dialog, if neccessary.
void askCreateSolverTestCase()
Mini-wizard to generate solver test case:
void applyResolutions()
Apply the choices the user made.
virtual QSize sizeHint() const
Reimplemented from QWidget: Reserve a reasonable amount of space.
void keyPressEvent(QKeyEvent *e)
Event handler for keyboard input.
Display package dependency conflicts in a tree list and let the user choose how to resolve each confl...
double averageSolveTime() const
Returns the average time in seconds used for solving or 0 if solving hasn't taken place yet...
int verifySystem()
Run the package dependency solver for the currently installed system plus the packages that are marke...
void prepareSolving()
Initialize solving: Post "busy" popup etc.
virtual ~YQPkgConflictDialog()
Destructor.
static void resetIgnoredDependencyProblems()
Reset all previously ignored dependency problems.
YQPkgConflictDialog(QWidget *parent)
Constructor.
void fill(zypp::ResolverProblemList problemList)
Fill the list with the specified problems.
int solveAndShowConflicts()
Run the package dependency solver for the current package set and open the conflict dialog if there a...