Salome HOME
84a80d8b955fb51808e366cf746db02691ffca53
[tools/install.git] / src / InstallWizard.cpp
1 //  File      : InstallWizard.cpp
2 //  Created   : Thu Mar 27 12:01:00 2003
3 //  Author    : Vadim SANDLER
4 //  Project   : PAL/SALOME
5 //  Module    : InstallWizard
6 //  Copyright : 2004 CEA
7 //  $Header$ 
8
9 #include "InstallWizard.h"
10
11 #include "qlayout.h"
12 #include "qpushbutton.h"
13 #include "qcursor.h"
14 #include "qlabel.h"
15 #include "qwidgetstack.h"
16 #include "qapplication.h"
17 #include "qptrlist.h"
18 #include "qpainter.h"
19 #include "qaccel.h"
20 #include "qhbox.h"
21 #include "qobjectlist.h"
22
23 class InstallWizardPrivate
24 {
25 public:
26   struct Page {
27     Page( QWidget * widget, const QString & title ):
28           w( widget ), t( title ),
29     backEnabled( TRUE ), nextEnabled( TRUE ), finishEnabled( FALSE ),
30     helpEnabled( TRUE ),
31     appropriate( TRUE )
32   {}
33   QWidget * w;
34   QString t;
35   bool backEnabled;
36   bool nextEnabled;
37   bool finishEnabled;
38   bool helpEnabled;
39   bool appropriate;
40   };
41   
42   QVBoxLayout * v;
43   Page * current;
44   QWidgetStack * ws;
45   QPtrList<Page> pages;
46   QLabel * title;
47   QHBox *  titleBox;
48   QHBox *  logoBox;
49   QPushButton * backButton;
50   QPushButton * nextButton;
51   QPushButton * finishButton;
52   QPushButton * cancelButton;
53   QPushButton * helpButton;
54   QFrame * hbar1, * hbar2;
55   
56 #ifndef QT_NO_ACCEL
57   QAccel * accel;
58   int backAccel;
59   int nextAccel;
60 #endif
61   
62   Page * page( const QWidget * w )
63   {
64     if ( !w )
65       return 0;
66     int i = pages.count();
67     while( --i >= 0 && pages.at( i ) && pages.at( i )->w != w ) { }
68     return i >= 0 ? pages.at( i ) : 0;
69   }
70 };
71
72
73 /*!  Constructs an empty wizard dialog.
74 The \a parent, \a name, \a modal and \a f arguments are passed to
75 the QDialog constructor.
76
77 */
78
79 InstallWizard::InstallWizard( QWidget *parent, const char *name, bool modal,
80                              WFlags f )
81   : QDialog( parent, name, modal, f )
82 {
83   d = new InstallWizardPrivate();
84   d->current = 0; // not quite true, but...
85   d->ws = new QWidgetStack( this, "qt_widgetstack" );
86   d->pages.setAutoDelete( TRUE );
87   d->titleBox = new QHBox( this, "title box" );
88   d->title = new QLabel( d->titleBox, "title label" );
89   d->logoBox = new QHBox( d->titleBox, "logo box" );
90   d->logoBox->setSpacing( 2 );
91   d->titleBox->setStretchFactor( d->title, 10 );
92   
93   // create in nice tab order
94   d->nextButton = new QPushButton( this, "next" );
95   d->finishButton = new QPushButton( this, "finish" );
96   d->helpButton = new QPushButton( this, "help" );
97   d->backButton = new QPushButton( this, "back" );
98   d->cancelButton = new QPushButton( this, "cancel" );
99   
100   d->ws->installEventFilter( this );
101   
102   d->v = 0;
103   d->hbar1 = 0;
104   d->hbar2 = 0;
105   
106   d->cancelButton->setText( tr( "&Cancel" ) );
107   d->backButton->setText( tr( "< &Back" ) );
108   d->nextButton->setText( tr( "&Next >" ) );
109   d->finishButton->setText( tr( "&Finish" ) );
110   d->helpButton->setText( tr( "&Help" ) );
111   
112   d->nextButton->setDefault( TRUE );
113   
114   connect( d->backButton, SIGNAL(clicked()),
115     this, SLOT(back()) );
116   connect( d->nextButton, SIGNAL(clicked()),
117     this, SLOT(next()) );
118   connect( d->finishButton, SIGNAL(clicked()),
119     this, SLOT(accept()) );
120   connect( d->cancelButton, SIGNAL(clicked()),
121     this, SLOT(reject()) );
122   connect( d->helpButton, SIGNAL(clicked()),
123     this, SLOT(help()) );
124   
125 #ifndef QT_NO_ACCEL
126   d->accel = new QAccel( this, "arrow-key accel" );
127   d->backAccel = d->accel->insertItem( Qt::ALT + Qt::Key_Left );
128   d->accel->connectItem( d->backAccel, this, SLOT(back()) );
129   d->nextAccel = d->accel->insertItem( Qt::ALT + Qt::Key_Right );
130   d->accel->connectItem( d->nextAccel, this, SLOT(next()) );
131 #endif
132 }
133
134
135 /*!
136 Destroys the object and frees any allocated resources, including
137 all pages and controllers.
138 */
139
140 InstallWizard::~InstallWizard()
141 {
142   delete d;
143 }
144
145
146 /*!  \reimp  */
147
148 void InstallWizard::show()
149 {
150   if ( d->current )
151     showPage( d->current->w );
152   else if ( pageCount() > 0 )
153     showPage( d->pages.at( 0 )->w );
154   else
155     showPage( 0 );
156   
157   QDialog::show();
158 }
159
160
161 /*! \reimp */
162
163 void InstallWizard::setFont( const QFont & font )
164 {
165   QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) );
166   QDialog::setFont( font );
167 }
168
169
170 /*!  Adds \a page to the end of the page sequence, with the title, \a title.
171 */
172
173 void InstallWizard::addPage( QWidget * page, const QString & title )
174 {
175   if ( !page )
176     return;
177   if ( d->page( page ) ) {
178 #if defined(QT_CHECK_STATE)
179     qWarning( "InstallWizard::addPage(): already added %s/%s to %s/%s",
180       page->className(), page->name(),
181       className(), name() );
182 #endif
183     return;
184   }
185   int i = d->pages.count();
186   
187   if( i > 0 )
188     d->pages.at( i - 1 )->nextEnabled = TRUE;
189   
190   InstallWizardPrivate::Page * p = new InstallWizardPrivate::Page( page, title );
191   p->backEnabled = ( i > 0 );
192   d->ws->addWidget( page, i );
193   d->pages.append( p );
194 }
195
196 /*!
197 Inserts \a page at position \a index into the page sequence, with
198 title \a title. If \a index is -1, the page will be appended to
199 the end of the wizard's page sequence.
200 */
201
202 void InstallWizard::insertPage( QWidget * page, const QString & title, int index )
203 {
204   if ( !page )
205     return;
206   if ( d->page( page ) ) {
207 #if defined(QT_CHECK_STATE)
208     qWarning( "InstallWizard::insertPage(): already added %s/%s to %s/%s",
209       page->className(), page->name(),
210       className(), name() );
211 #endif
212     return;
213   }
214   
215   if ( index < 0  || index > (int)d->pages.count() )
216     index = d->pages.count();
217   
218   if( index > 0 && ( index == (int)d->pages.count() ) )
219     d->pages.at( index - 1 )->nextEnabled = TRUE;
220   
221   InstallWizardPrivate::Page * p = new InstallWizardPrivate::Page( page, title );
222   p->backEnabled = ( index > 0 );
223   p->nextEnabled = ( index < (int)d->pages.count() );
224   
225   d->ws->addWidget( page, index );
226   d->pages.insert( index, p );
227 }
228
229 /*!
230 \fn void InstallWizard::selected(const QString&)
231
232   This signal is emitted when the current page changes. The parameter
233   contains the title of the selected page.
234 */
235
236
237 /*!  Makes \a page the current page and emits the selected() signal. */
238
239 void InstallWizard::showPage( QWidget * page )
240 {
241   InstallWizardPrivate::Page * p = d->page( page );
242   if ( p ) {
243     int i;
244     for( i = 0; i < (int)d->pages.count() && d->pages.at( i ) != p; i++ );
245     bool notFirst( FALSE );
246     
247     if( i ) {
248       i--;
249       while( ( i >= 0 ) && !notFirst ) {
250         notFirst |= appropriate( d->pages.at( i )->w );
251         i--;
252       }
253     }
254     setBackEnabled( notFirst );
255     setNextEnabled( TRUE );
256     d->ws->raiseWidget( page );
257     d->current = p;
258   }
259   
260   layOut();
261   updateButtons();
262   emit selected( p ? p->t : QString::null );
263 }
264
265
266 /*!  Returns the number of pages in the wizard. */
267
268 int InstallWizard::pageCount() const
269 {
270   return d->pages.count();
271 }
272
273 /*!
274 Returns the position of page \a page.
275 If the page is not part of the wizard -1 is returned.
276 */
277
278 int InstallWizard::indexOf( QWidget* page ) const
279 {
280   InstallWizardPrivate::Page * p = d->page( page );
281   if ( !p ) return -1;
282   
283   return d->pages.find( p );
284 }
285
286 /*!
287 Called when the user clicks the Back button; this function shows
288 the preceding relevant page in the sequence.
289
290   \sa appropriate()
291 */
292 void InstallWizard::back()
293 {
294   int i = 0;
295   
296   while( i < (int)d->pages.count() && d->pages.at( i ) &&
297      d->current && d->pages.at( i )->w != d->current->w )
298      i++;
299   
300   i--;
301   while( i >= 0 && ( !d->pages.at( i ) || !appropriate( d->pages.at( i )->w ) ) )
302     i--;
303   
304   if( i >= 0 )
305     if( d->pages.at( i ) )
306       showPage( d->pages.at( i )->w );
307 }
308
309
310 /*!
311 Called when the user clicks the Next button, this function shows
312 the next relevant page in the sequence.
313
314   \sa appropriate()
315 */
316 void InstallWizard::next()
317 {
318   int i = 0;
319   while( i < (int)d->pages.count() && d->pages.at( i ) &&
320     d->current && d->pages.at( i )->w != d->current->w )
321     i++;
322   i++;
323   while( i <= (int)d->pages.count()-1 &&
324     ( !d->pages.at( i ) || !appropriate( d->pages.at( i )->w ) ) )
325      i++;
326   // if we fell of the end of the world, step back
327   while ( i > 0 && (i >= (int)d->pages.count() || !d->pages.at( i ) ) )
328     i--;
329   if ( d->pages.at( i ) ) {
330     if ( d->current && !acceptData( d->current->t ) )
331       return;
332     showPage( d->pages.at( i )->w );
333   }
334 }
335
336
337 /*!
338 \fn void InstallWizard::helpClicked()
339
340   This signal is emitted when the user clicks on the Help button.
341 */
342
343 /*!  Called when the user clicks the Help button, this function emits the
344 helpClicked() signal.
345 */
346
347 void InstallWizard::help()
348 {
349   QWidget * page = d->ws->visibleWidget();
350   if ( !page )
351     return;
352   
353 #if 0
354   if ( page->inherits( "InstallWizardPage" ) )
355     emit ((InstallWizardPage *)page)->helpClicked();
356 #endif
357   emit helpClicked();
358 }
359
360
361 void InstallWizard::setBackEnabled( bool enable )
362 {
363   d->backButton->setEnabled( enable );
364 #ifndef QT_NO_ACCEL
365   d->accel->setItemEnabled( d->backAccel, enable );
366 #endif
367 }
368
369
370 void InstallWizard::setNextEnabled( bool enable )
371 {
372   d->nextButton->setEnabled( enable );
373 #ifndef QT_NO_ACCEL
374   d->accel->setItemEnabled( d->nextAccel, enable );
375 #endif
376 }
377
378
379 void InstallWizard::setHelpEnabled( bool enable )
380 {
381   d->helpButton->setEnabled( enable );
382 }
383
384
385 /*!
386 \fn void InstallWizard::setFinish( QWidget *, bool )
387 \obsolete
388
389   Use setFinishEnabled instead
390 */
391
392 /*!
393 If \a enable is TRUE, page \a page has a Back button; otherwise \a
394 page has no Back button.
395 By default all pages have this button.
396 */
397 void InstallWizard::setBackEnabled( QWidget * page, bool enable )
398 {
399   InstallWizardPrivate::Page * p = d->page( page );
400   if ( !p )
401     return;
402   
403   p->backEnabled = enable;
404   updateButtons();
405 }
406
407
408 /*!
409 If \a enable is TRUE, page \a page has a Next button; otherwise
410 the Next button on \a page is disabled. By default all pages have
411 this button.
412 */
413
414 void InstallWizard::setNextEnabled( QWidget * page, bool enable )
415 {
416   InstallWizardPrivate::Page * p = d->page( page );
417   if ( !p )
418     return;
419   
420   p->nextEnabled = enable;
421   updateButtons();
422 }
423
424
425 /*!
426 If \a enable is TRUE, page \a page has a Finish button; otherwise \a
427 page has no Finish button.
428 By default \e no page has this button.
429 */
430 void InstallWizard::setFinishEnabled( QWidget * page, bool enable )
431 {
432   InstallWizardPrivate::Page * p = d->page( page );
433   if ( !p )
434     return;
435   
436   p->finishEnabled = enable;
437   updateButtons();
438 }
439
440
441 /*!
442 If \a enable is TRUE, page \a page has a Help button; otherwise \a
443 page has no Help button.
444 By default all pages have this button.
445 */
446 void InstallWizard::setHelpEnabled( QWidget * page, bool enable )
447 {
448   InstallWizardPrivate::Page * p = d->page( page );
449   if ( !p )
450     return;
451   
452   p->helpEnabled = enable;
453   updateButtons();
454 }
455
456
457 /*!
458 Called when the Next button is clicked; this virtual function
459 returns TRUE if \a page is relevant for display in the current
460 context; otherwise it is ignored by InstallWizard and returns FALSE. The
461 default implementation returns the value set using
462 setAppropriate(). The ultimate default is TRUE.
463
464   \warning The last page of the wizard will be displayed if no page is relevant
465   in the current context.
466 */
467
468 bool InstallWizard::appropriate( QWidget * page ) const
469 {
470   InstallWizardPrivate::Page * p = d->page( page );
471   return p ? p->appropriate : TRUE;
472 }
473
474
475 /*!
476 If \a appropriate is TRUE then page \a page is considered relevant
477 in the current context and should be displayed in the page sequence;
478 otherwise \a page should not be displayed in the page sequence.
479
480   \sa appropriate()
481 */
482 void InstallWizard::setAppropriate( QWidget * page, bool appropriate )
483 {
484   InstallWizardPrivate::Page * p = d->page( page );
485   if ( p )
486     p->appropriate = appropriate;
487 }
488
489
490 void InstallWizard::updateButtons()
491 {
492   if ( !d->current )
493     return;
494   
495   int i;
496   for( i = 0; i < (int)d->pages.count() && d->pages.at( i ) != d->current; i++ );
497   bool notFirst( FALSE );
498   if( i ) {
499     i--;
500     while( ( i >= 0 ) && !notFirst ) {
501       notFirst |= appropriate( d->pages.at( i )->w );
502       i--;
503     }
504   }
505   setBackEnabled( d->current->backEnabled && notFirst );
506   setNextEnabled( d->current->nextEnabled );
507   d->finishButton->setEnabled( d->current->finishEnabled );
508   d->helpButton->setEnabled( d->current->helpEnabled );
509   
510   if ( ( d->current->finishEnabled && !d->finishButton->isVisible() ) ||
511     ( d->current->backEnabled && !d->backButton->isVisible() ) ||
512     ( d->current->nextEnabled && !d->nextButton->isVisible() ) ||
513     ( d->current->helpEnabled && !d->helpButton->isVisible() ) )
514     layOut();
515 }
516
517
518 /*!  Returns a pointer to the current page in the sequence.
519 Although the wizard does its best to make sure that this value is
520 never 0, it can be if you try hard enough.
521 */
522
523 QWidget * InstallWizard::currentPage() const
524 {
525   return d->ws->visibleWidget();
526 }
527
528
529 /*!  Returns the title of page \a page.
530 */
531
532 QString InstallWizard::title( QWidget * page ) const
533 {
534   InstallWizardPrivate::Page * p = d->page( page );
535   return p ? p->t : QString::null;
536 }
537
538 /*!  Sets the title for page \a page to \a title.
539 */
540
541 void InstallWizard::setTitle( QWidget *page, const QString &title )
542 {
543   InstallWizardPrivate::Page * p = d->page( page );
544   if ( p )
545     p->t = title;
546   if ( page == currentPage() )
547     d->title->setText( title );
548 }
549
550 /*!
551 \property InstallWizard::titleFont
552 \brief the font used for page titles
553
554   The default is QApplication::font().
555 */
556 QFont InstallWizard::titleFont() const
557 {
558   return d->title->font();
559 }
560
561 void InstallWizard::setTitleFont( const QFont & font )
562 {
563   d->title->setFont( font );
564 }
565
566
567 /*!
568 Returns a pointer to the dialog's Back button
569
570   By default, this button is connected to the back() slot,
571   which is virtual so you can reimplement it in a InstallWizard subclass.
572 */
573 QPushButton * InstallWizard::backButton() const
574 {
575   return d->backButton;
576 }
577
578
579 /*!
580 Returns a pointer to the dialog's Next button
581
582   By default, this button is connected to the next() slot,
583   which is virtual so you can reimplement it in a InstallWizard subclass.
584 */
585 QPushButton * InstallWizard::nextButton() const
586 {
587   return d->nextButton;
588 }
589
590
591 /*!
592 Returns a pointer to the dialog's Finish button
593
594   By default, this button is connected to the QDialog::accept() slot,
595   which is virtual so you can reimplement it in a InstallWizard subclass.
596 */
597 QPushButton * InstallWizard::finishButton() const
598 {
599   return d->finishButton;
600 }
601
602
603 /*!
604 Returns a pointer to the dialog's Cancel button
605
606   By default, this button is connected to the QDialog::reject() slot,
607   which is virtual so you can reimplement it in a InstallWizard subclass.
608 */
609 QPushButton * InstallWizard::cancelButton() const
610 {
611   return d->cancelButton;
612 }
613
614
615 /*!
616 Returns a pointer to the dialog's Help button
617
618   By default, this button is connected to the help() slot,
619   which is virtual so you can reimplement it in a InstallWizard subclass.
620 */
621 QPushButton * InstallWizard::helpButton() const
622 {
623   return d->helpButton;
624 }
625
626
627 /*!  This virtual function is responsible for adding the bottom
628 divider and the buttons below it.
629
630   \a layout is the vertical layout of the entire wizard.
631 */
632
633 void InstallWizard::layOutButtonRow( QHBoxLayout * layout )
634 {
635   bool hasHelp = FALSE;
636   bool hasEarlyFinish = FALSE;
637   
638   int i = d->pages.count() - 2;
639   while ( !hasEarlyFinish && i >= 0 ) {
640     if ( d->pages.at( i ) && d->pages.at( i )->finishEnabled )
641       hasEarlyFinish = TRUE;
642     i--;
643   }
644   i = 0;
645   while ( !hasHelp && i < (int)d->pages.count() ) {
646     if ( d->pages.at( i ) && d->pages.at( i )->helpEnabled )
647       hasHelp = TRUE;
648     i++;
649   }
650   
651   QBoxLayout * h = new QBoxLayout( QBoxLayout::LeftToRight );
652   layout->addLayout( h );
653   
654   h->addWidget( d->cancelButton );
655   
656   h->addStretch( 42 );
657   
658   h->addWidget( d->backButton );
659   
660   h->addSpacing( 6 );
661   
662   if ( hasEarlyFinish ) {
663     d->nextButton->show();
664     d->finishButton->show();
665     h->addWidget( d->nextButton );
666     h->addSpacing( 12 );
667     h->addWidget( d->finishButton );
668   } else if ( d->pages.count() == 0 ||
669     d->current->finishEnabled ||
670     d->current == d->pages.at( d->pages.count()-1 ) ) {
671     d->nextButton->hide();
672     d->finishButton->show();
673     h->addWidget( d->finishButton );
674   } else {
675     d->nextButton->show();
676     d->finishButton->hide();
677     h->addWidget( d->nextButton );
678   }
679   
680   // if last page is disabled - show finished btn. at lastpage-1
681   i = d->pages.count()-1;
682   if ( i >= 0 && !appropriate( d->pages.at( i )->w ) &&
683     d->current == d->pages.at( d->pages.count()-2 ) ) {
684     d->nextButton->hide();
685     d->finishButton->show();
686     h->addWidget( d->finishButton );
687   }
688   
689   if ( hasHelp ) {
690     h->addSpacing( 12 );
691     h->addWidget( d->helpButton );
692   } else {
693     d->helpButton->hide();
694   }
695 }
696
697
698 /*!
699 This virtual function is responsible for laying out the title row
700 and adding the vertical divider between the title and the wizard
701 page. \a layout is the vertical layout for the wizard, and \a
702 title is the title for this page. This function is called every
703 time \a title changes.
704 */
705
706 void InstallWizard::layOutTitleRow( QHBoxLayout * layout, const QString & title )
707 {
708   d->title->setText( title );
709   layout->addWidget( d->titleBox, 10 );
710 }
711
712 /*!
713 Validates page when 'Next' or 'Finish' button is clicked.
714 Should return true in success
715 */
716 bool InstallWizard::acceptData( const QString& )
717 {
718   return TRUE;
719 }
720
721 /*
722
723 */
724
725 void InstallWizard::layOut()
726 {
727   delete d->v;
728   d->v = new QVBoxLayout( this, 11, 0, "top-level layout" );
729   
730   QHBoxLayout * l;
731   l = new QHBoxLayout( 6 );
732   d->v->addLayout( l, 0 );
733   layOutTitleRow( l, d->current ? d->current->t : QString::null );
734   
735   if ( ! d->hbar1 ) {
736     d->hbar1 = new QFrame( this, "<hr>", 0 );
737     d->hbar1->setFrameStyle( QFrame::Sunken + QFrame::HLine );
738     d->hbar1->setFixedHeight( 12 );
739   }
740   
741   d->v->addWidget( d->hbar1 );
742   
743   d->v->addWidget( d->ws, 10 );
744   
745   if ( ! d->hbar2 ) {
746     d->hbar2 = new QFrame( this, "<hr>", 0 );
747     d->hbar2->setFrameStyle( QFrame::Sunken + QFrame::HLine );
748     d->hbar2->setFixedHeight( 12 );
749   }
750   d->v->addWidget( d->hbar2 );
751   
752   l = new QHBoxLayout( 6 );
753   d->v->addLayout( l );
754   layOutButtonRow( l );
755   d->v->activate();
756 }
757
758
759 /*! \reimp */
760
761 bool InstallWizard::eventFilter( QObject * o, QEvent * e )
762 {
763   if ( o == d->ws && e && e->type() == QEvent::ChildRemoved ) {
764     QChildEvent * c = (QChildEvent*)e;
765     if ( c->child() && c->child()->isWidgetType() )
766       removePage( (QWidget *)c->child() );
767   }
768   return QDialog::eventFilter( o, e );
769 }
770
771
772 /*!
773 Removes \a page from the page sequence but does not delete the page.
774 If \a page is currently being displayed, InstallWizard will display the
775 page that precedes it, or the first page if this was the first page.
776 */
777
778 void InstallWizard::removePage( QWidget * page )
779 {
780   if ( !page )
781     return;
782   
783   int i = d->pages.count();
784   QWidget* cp = currentPage();
785   while( --i >= 0 && d->pages.at( i ) && d->pages.at( i )->w != page ) { }
786   if ( i < 0 )
787     return;
788   InstallWizardPrivate::Page * p = d->pages.at( i );
789   d->pages.removeRef( p );
790   d->ws->removeWidget( page );
791   
792   if( cp == page ) {
793     i--;
794     if( i < 0 )
795       i = 0;
796     if ( pageCount() > 0 )
797       showPage( InstallWizard::page( i ) );
798   }
799 }
800
801
802 /*!
803 Returns a pointer to the page at position \a index in the sequence,
804 or 0 if \a index is out of range. The first page has index 0.
805 */
806
807 QWidget* InstallWizard::page( int index ) const
808 {
809   if ( index >= pageCount() || index < 0 )
810     return 0;
811   
812   return d->pages.at( index )->w;
813 }
814
815 /*!
816 Returns a pointer to the page with a title \a title in the sequence,
817 or 0 if not found.
818 */
819 QWidget* InstallWizard::page( const QString& title ) const
820 {
821   for( int i = 0; i < (int)d->pages.count(); i++ ) {
822     if ( d->pages.at( i )->t == title )
823       return d->pages.at( i )->w;
824   }
825   return 0;
826 }
827
828 /*!
829 Adds logo to be shown at the right of the page title
830 */
831 void InstallWizard::addLogo( const QPixmap& pm )
832 {
833   QLabel* logo = new QLabel( d->logoBox, "logo" );
834   logo->setPixmap( pm );
835   logo->setAlignment( AlignCenter );
836   logo->setScaledContents( false );
837   logo->show();
838 }
839
840 /*!
841 Remove all logos
842 */
843 void InstallWizard::removeLogos()
844 {
845   QObjectList* children = d->logoBox->queryList( "QLabel" );
846   if ( children ) {
847     QObjectListIt it( *children );
848     QObject *obj;
849     while ( (obj = it.current()) != 0 ) {
850       ++it;
851       delete obj;
852     }
853   }
854   delete children;
855 }