1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
17 Textdomain "packages-qt"
22 #define y2log_component "qt-wizard"
23 #include <ycp/y2log.h>
25 // For the command parser
28 #include <YShortcut.h>
31 #include <QSvgRenderer>
33 #include <QStackedWidget>
34 #include "ui_QHelpDialog.h"
39 #include <qmenudata.h>
42 #include <qpushbutton.h>
44 #include <qtabwidget.h>
45 #include <qtoolbutton.h>
47 #include "QY2ListView.h"
48 #include <QGridLayout>
54 #include "YQApplication.h"
56 #include "YQAlignment.h"
57 #include "YQReplacePoint.h"
60 #include "YQWizardButton.h"
61 #include "YQIconPool.h"
62 #include "YQWidgetFactory.h"
63 #include "YQSignalBlocker.h"
72 #define TEXTDOMAIN "packages-qt"
74 #define USE_ICON_ON_HELP_BUTTON 0
77 YQWizard::YQWizard( YWidget * parent,
78 const string & backButtonLabel,
79 const string & abortButtonLabel,
80 const string & nextButtonLabel,
81 YWizardMode wizardMode )
82 : QFrame( (QWidget *) parent->widgetRep() )
88 , _backButtonLabel( backButtonLabel )
89 , _abortButtonLabel( abortButtonLabel )
90 , _nextButtonLabel( nextButtonLabel )
92 QHBoxLayout* layout = new QHBoxLayout( this );
93 layout->setSpacing( 0 );
94 layout->setMargin( 0 );
98 _stepsEnabled = (wizardMode == YWizardMode_Steps);
99 _treeEnabled = (wizardMode == YWizardMode_Tree);
102 _direction = YQWizard::Forward;
109 _releaseNotesButton = 0;
120 _sendButtonEvents = true;
121 _contentsReplacePoint = 0;
123 //FIXME _stepsList.setAutoDelete( true );
124 //FIXME _stepsIDs.setAutoDelete( false ); // Only for one of both!
126 YQUI::setTextdomain( TEXTDOMAIN );
128 //layoutTitleBar( this );
130 layout->addLayout( layoutSideBar( this ) );
131 layout->addWidget( layoutWorkArea( this ) );
136 YQWizard::~YQWizard()
143 void YQWizard::layoutTitleBar( QWidget * parent )
145 QFrame * titleBar = new QFrame( parent );
146 YUI_CHECK_NEW( titleBar );
148 QHBoxLayout *layout = new QHBoxLayout( titleBar );
149 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert
155 QLabel * left = new QLabel( titleBar );
156 layout->addWidget( left );
157 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
158 left->setObjectName( "titleBar-left" );
161 // Center stretch space
164 layout->addStretch( 10 );
171 QLabel * right = new QLabel( titleBar );
172 YUI_CHECK_NEW( right );
174 layout->addWidget( right );
175 right->setObjectName( "titleBar-right" );
180 QLayout *YQWizard::layoutSideBar( QWidget * parent )
182 _sideBar = new QStackedWidget( parent );
183 YUI_CHECK_NEW( _sideBar );
184 _sideBar->setMinimumWidth( YQUI::ui()->defaultSize( YD_HORIZ ) / 5 );
185 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) ); // hor/vert
187 QVBoxLayout *vbox = new QVBoxLayout( );
188 vbox->addWidget( _sideBar );
197 else if ( _stepsEnabled )
206 void YQWizard::layoutStepsPanel()
209 _stepsPanel = new QFrame( _sideBar );
210 _sideBar->addWidget( _stepsPanel );
211 _sideBar->setObjectName( "steps" );
212 _stepsPanel->setProperty( "class", "steps QFrame" );
214 // Steps panel bottom buttons ("Help", "Release Notes")
216 // Layouts for the buttons
218 _releaseNotesButton = new QPushButton( _( "Release Notes..." ), _stepsPanel );
219 _releaseNotesButton->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ) ); // hor/vert
221 connect( _releaseNotesButton, SIGNAL( clicked() ),
222 this, SLOT ( releaseNotesClicked() ) );
224 _releaseNotesButton->hide(); // hidden until showReleaseNotesButton() is called
226 _stepsDirty = true; // no layout yet
231 void YQWizard::addStep( const string & text, const string & id )
233 QString qId = fromUTF8( id );
235 if ( _stepsIDs[ qId ] )
237 y2error( "Step ID \"%s\" (\"%s\") already used for \"%s\"",
240 qPrintable( _stepsIDs[ qId ]->name() ) );
244 if ( _stepsList.last() && _stepsList.last()->name() == fromUTF8( text ) )
246 // Consecutive steps with the same name will be shown as one single step.
248 // Since steps are always added at the end of the list, it is
249 // sufficient to check the last step of the list. If the texts are the
250 // same, the other with the same text needs to get another (additional)
251 // ID to make sure setCurrentStep() works as it should.
252 _stepsList.last()->addID( qId );
256 _stepsList.append( new YQWizard::Step( fromUTF8( text ), qId ) );
260 _stepsIDs.insert( qId, _stepsList.last() );
265 void YQWizard::addStepHeading( const string & text )
267 _stepsList.append( new YQWizard::StepHeading( fromUTF8( text ) ) );
273 void YQWizard::updateSteps()
278 // Create a grid layout for the steps
279 QVBoxLayout *_stepsVBox = new QVBoxLayout( _stepsPanel );
281 QGridLayout *_stepsGrid = new QGridLayout( );
282 YUI_CHECK_NEW( _stepsGrid );
283 _stepsVBox->addLayout( _stepsGrid );
284 _stepsGrid->setColumnMinimumWidth( 0, 10 );
285 _stepsGrid->setRowStretch( 0, 1 );
286 _stepsGrid->setRowStretch( 1, 1 );
287 _stepsGrid->setRowStretch( 2, 99 );
289 const int statusCol = 1;
290 const int nameCol = 2;
295 // Create widgets for all steps and step headings in the internal list
298 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
300 YQWizard::Step * step = *i;
301 if ( step->isHeading() )
307 QLabel * label = new QLabel( step->name(), _stepsPanel );
308 YUI_CHECK_NEW( label );
309 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
310 label->setProperty( "class", "steps_heading" );
312 step->setNameLabel( label );
313 _stepsGrid->addWidget( label,
315 1, nameCol - statusCol + 1);
317 else // No heading - ordinary step
323 QLabel * statusLabel = new QLabel( _stepsPanel );
324 YUI_CHECK_NEW( statusLabel );
326 step->setStatusLabel( statusLabel );
327 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
328 _stepsGrid->addWidget( statusLabel, row, statusCol );
334 QLabel * nameLabel = new QLabel( step->name(), _stepsPanel );
335 YUI_CHECK_NEW( nameLabel );
336 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
338 step->setNameLabel( nameLabel );
339 _stepsGrid->addWidget( nameLabel, row, nameCol );
345 _stepsVBox->addStretch( 99 );
346 QVBoxLayout *rbl = new QVBoxLayout();
347 rbl->addWidget( _releaseNotesButton, 0, Qt::AlignCenter );
349 _stepsVBox->addLayout( rbl );
350 _stepsVBox->addStretch( 29 );
356 void YQWizard::updateStepStates()
361 YQWizard::Step * currentStep = findStep( _currentStepID );
362 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
366 // Set status icon and color for the current step
367 currentStep->setStatus( Step::Current );
370 // Set all steps before the current to "done"
373 while ( step != _stepsList.end() && *step != currentStep )
375 ( *step )->setStatus( Step::Done );
379 // Skip the current step - continue with the step after it
381 if ( step != _stepsList.end() )
386 // Set all steps after the current to "to do"
389 while ( step != _stepsList.end() )
391 ( *step )->setStatus( Step::Todo );
396 void YQWizard::setCurrentStep( const string & id )
398 _currentStepID = fromUTF8( id );
403 void YQWizard::deleteSteps()
410 YQWizard::Step * YQWizard::findStep( const QString & id )
415 return _stepsIDs[ id ];
419 void YQWizard::layoutHelpPanel()
424 // Button box with bottom gradient
427 QLabel * buttonBox = new QLabel( _sideBar );
428 YUI_CHECK_NEW( buttonBox );
430 QPushButton * button;
434 // "Tree" button - intentionally without keyboard shortcut
435 button = new QPushButton( _( "Tree" ), buttonBox );
436 YUI_CHECK_NEW( button );
437 _treeButton = button;
438 button->setObjectName( "treeButton" );
443 // "Steps" button - intentionally without keyboard shortcut
444 button = new QPushButton( _( "Steps" ), buttonBox );
445 YUI_CHECK_NEW( button );
446 _stepsButton = button;
447 _stepsButton->hide();
448 _stepsButton->setObjectName( "stepsButton" );
452 // Create a dummy button just to find out how high it would become
453 button = new QPushButton( "Dummy", buttonBox );
454 YUI_CHECK_NEW( button );
457 layoutSideBarButtonBox( buttonBox, button );
461 connect( button, SIGNAL( clicked() ),
462 this, SLOT ( showTree() ) );
464 else if ( _stepsEnabled )
466 connect( button, SIGNAL( clicked() ),
467 this, SLOT ( showSteps() ) );
471 // Hide the dummy button - the button box height is fixed now.
477 void YQWizard::layoutTreePanel()
479 _treePanel = new QFrame( _sideBar );
480 YUI_CHECK_NEW( _treePanel );
481 QHBoxLayout *layout = new QHBoxLayout( _treePanel );
482 _sideBar->addWidget( _treePanel );
484 QVBoxLayout * vbox = new QVBoxLayout();
485 YUI_CHECK_NEW( vbox );
486 layout->addLayout( vbox );
490 _tree = new QY2ListView( _treePanel );
491 YUI_CHECK_NEW( _tree );
492 vbox->addWidget( _tree );
495 // _tree->addColumn( "" );
496 // _tree->header()->hide();
498 _tree->setRootIsDecorated( true );
499 _tree->setSortByInsertionSequence( true );
501 connect( _tree, SIGNAL( selectionChanged ( void ) ),
502 this, SLOT ( treeSelectionChanged ( void ) ) );
504 connect( _tree, SIGNAL( spacePressed ( QTreeWidgetItem * ) ),
505 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
507 connect( _tree, SIGNAL( doubleClicked ( QTreeWidgetItem * ) ),
508 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
513 void YQWizard::addTreeItem( const string & parentID, const string & text, const string & id )
515 QString qId = fromUTF8( id );
519 y2error( "YQWizard widget not created with `opt(`treeEnabled) !" );
523 YQWizard::TreeItem * item = 0;
524 YQWizard::TreeItem * parent = 0;
526 if ( ! parentID.empty() )
528 parent = findTreeItem( parentID );
533 item = new YQWizard::TreeItem( parent, fromUTF8( text ), qId );
534 YUI_CHECK_NEW( item );
538 item = new YQWizard::TreeItem( _tree, fromUTF8( text ), qId );
539 YUI_CHECK_NEW( item );
542 if ( ! qId.isEmpty() )
543 _treeIDs.insert( qId, item );
548 void YQWizard::deleteTreeItems()
558 YQWizard::TreeItem * YQWizard::findTreeItem( const string & id )
563 return _treeIDs[ fromUTF8( id ) ];
567 void YQWizard::selectTreeItem( const string & id )
571 YQWizard::TreeItem * item = findTreeItem( id );
575 YQSignalBlocker sigBlocker( _tree );
577 _tree->setCurrentItem(item);
578 _tree->scrollToItem(item);
584 void YQWizard::sendTreeEvent( QTreeWidgetItem * listViewItem )
588 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> ( listViewItem );
590 if ( item && ! item->id().isEmpty() )
591 sendEvent( toUTF8( item->id() ) );
596 void YQWizard::treeSelectionChanged()
597 { //FIXME is currentItem correct or selected.first
599 sendTreeEvent( _tree->currentItem() );
603 string YQWizard::currentTreeSelection()
607 QTreeWidgetItem * sel = _tree->currentItem();
611 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> (sel);
613 if ( item && ! item->id().isEmpty() )
614 return toUTF8( item->id() );
623 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
625 QFrame *workArea = new QFrame( parent );
626 workArea->setObjectName( "work_area" );
628 QVBoxLayout *vbox = new QVBoxLayout( workArea );
630 _menuBar = new QMenuBar( workArea );
631 YUI_CHECK_NEW( _menuBar );
633 _menuBar->hide(); // will be made visible when menus are added
634 vbox->addWidget( _menuBar );
637 // Dialog icon and heading
640 QHBoxLayout * headingHBox = new QHBoxLayout();
641 YUI_CHECK_NEW( headingHBox );
642 //headingHBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
643 vbox->addLayout( headingHBox );
645 _dialogIcon = new QLabel( workArea );
646 YUI_CHECK_NEW( _dialogIcon );
647 headingHBox->addWidget( _dialogIcon );
648 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); // hor/vert
649 _dialogIcon->setObjectName( "DialogIcon" );
651 _dialogHeading = new QLabel( workArea );
652 YUI_CHECK_NEW( _dialogHeading );
653 headingHBox->addWidget( _dialogHeading );
654 _dialogHeading->setAlignment( Qt::AlignLeft );
655 _dialogHeading->setWordWrap( true );
656 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
657 _dialogHeading->setObjectName( "DialogHeading" );
660 // Client area (the part that belongs to the YCP application)
663 layoutClientArea( workArea );
664 vbox->addWidget( _clientArea );
670 QLayout *bb = layoutButtonBox( workArea );
671 vbox->addLayout( bb );
678 void YQWizard::layoutClientArea( QWidget * parent )
680 _clientArea = new QFrame( parent );
681 YUI_CHECK_NEW( _clientArea );
682 QVBoxLayout *layout = new QVBoxLayout( _clientArea );
683 // _clientArea->layout()->setMargin( 4 );
686 // HVCenter for wizard contents
689 _contents = new YQAlignment( this, _clientArea, YAlignCenter, YAlignCenter );
690 YUI_CHECK_NEW( _contents );
691 layout->addWidget( _contents );
692 _contents->QObject::setProperty( "class", "Contents" );
694 _contents->setStretchable( YD_HORIZ, true );
695 _contents->setStretchable( YD_VERT, true );
696 _contents->installEventFilter( this );
697 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // hor/vert
700 // Replace point for wizard contents
703 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
706 // Initial YEmpty widget contents of replace point
709 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
710 _contentsReplacePoint->showChild();
716 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
719 // QHBoxLayout for the buttons
722 QHBoxLayout * hbox = new QHBoxLayout(); // parent, spacing
723 YUI_CHECK_NEW( hbox );
725 hbox->setSpacing( 0 );
726 hbox->setMargin( 0 );
728 // Help button - intentionally without keyboard shortcut
729 _helpButton = new QPushButton( _( "Help" ), parent );
730 YUI_CHECK_NEW( _helpButton );
732 connect( _helpButton, SIGNAL( clicked() ),
733 this, SLOT ( showHelp() ) );
735 hbox->addWidget( _helpButton );
737 hbox->addStretch( 10 );
743 _abortButton = new YQWizardButton( this, parent, _abortButtonLabel );
744 YUI_CHECK_NEW( _abortButton );
746 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
747 connect( _abortButton, SIGNAL( clicked() ),
748 this, SLOT ( slotAbortClicked() ) );
750 hbox->addSpacing( 10 );
756 _backButton = new YQWizardButton( this, parent, _backButtonLabel );
757 YUI_CHECK_NEW( _backButton );
759 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
760 connect( _backButton, SIGNAL( clicked() ),
761 this, SLOT ( slotBackClicked() ) );
763 if ( _backButton->text().isEmpty() )
770 hbox->addSpacing( 5 );
772 _nextButton = new YQWizardButton( this, parent, _nextButtonLabel );
773 YUI_CHECK_NEW( _nextButton );
775 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
776 connect( _nextButton, SIGNAL( clicked() ),
777 this, SLOT ( slotNextClicked() ) );
782 void YQWizard::destroyButtons()
795 void YQWizard::connectNotify ( const char * signal )
797 if ( QString( signal ).contains( "nextClicked()" ) )
799 y2debug( "nextClicked connected, no longer directly sending button events" );
800 _sendButtonEvents = false;
805 void YQWizard::disconnectNotify ( const char * signal )
807 if ( QString( signal ).contains( "nextClicked()" ) )
809 y2debug( "nextClicked disconnected, directly sending button events again" );
810 _sendButtonEvents = true;
815 void YQWizard::setDialogIcon( const string & iconName )
819 if ( ! iconName.empty() )
821 QPixmap icon( iconName.c_str() );
824 y2warning( "Couldn't load dialog icon \"%s\"", iconName.c_str() );
827 _dialogIcon->setPixmap( icon );
828 topLevelWidget()->setWindowIcon( icon );
833 _dialogIcon->clear();
834 topLevelWidget()->setWindowIcon( QIcon() );
840 void YQWizard::setDialogHeading( const string & headingText )
842 if ( _dialogHeading )
844 if ( ! headingText.empty() )
845 _dialogHeading->setText( fromUTF8( headingText ) );
847 _dialogHeading->clear();
851 string YQWizard::debugLabel()
853 if ( _dialogHeading )
855 QString label = _dialogHeading->text();
856 label = label.simplified(); // Replace any embedded newline with a single blank
858 if ( ! label.isEmpty() )
860 label.prepend( "YQWizard \"" );
861 label.append( "\"" );
863 return toUTF8( label );
867 return "untitled YQWizard";
870 void YQWizard::setHelpText( const string & helpText )
872 _qHelpText = fromUTF8( helpText );
873 _qHelpText.replace( "&product;", YQUI::ui()->productName() );
877 void YQWizard::slotBackClicked()
881 if ( _sendButtonEvents )
882 YQUI::ui()->sendEvent( new YWidgetEvent( _backButton, YEvent::Activated ) );
884 _direction = YQWizard::Backward;
888 void YQWizard::slotAbortClicked()
892 if ( _sendButtonEvents )
893 YQUI::ui()->sendEvent( new YWidgetEvent( _abortButton, YEvent::Activated ) );
897 void YQWizard::slotNextClicked()
901 if ( _sendButtonEvents )
902 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
904 _direction = YQWizard::Forward;
908 void YQWizard::showHelp()
910 QDialog helpDlg( this );
912 ui.setupUi( &helpDlg );
913 ui.textBrowser->setText( _qHelpText );
918 void YQWizard::releaseNotesClicked()
920 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
922 if ( ! _releaseNotesButtonId.empty() )
924 y2milestone( "Release Notes button clicked" );
925 sendEvent( _releaseNotesButtonId );
930 void YQWizard::showSteps()
932 if ( _sideBar && _stepsPanel )
934 _sideBar->setCurrentWidget( _stepsPanel );
939 void YQWizard::showTree()
941 if ( _sideBar && _treePanel )
943 _sideBar->setCurrentWidget( _treePanel );
949 void YQWizard::addMenu( const string & text,
954 QMenu * menu = new QMenu( _menuBar );
955 YUI_CHECK_NEW( menu );
957 _menuIDs.insert( fromUTF8( id ), menu );
958 //FIXME _menuBar->insertItem( fromUTF8( text ), menu );
960 connect( menu, SIGNAL( activated ( int ) ),
961 this, SLOT ( sendMenuEvent( int ) ) );
968 void YQWizard::addSubMenu( const string & parentMenuID,
972 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
976 QMenu * menu = new QMenu( _menuBar );
977 YUI_CHECK_NEW( menu );
979 _menuIDs.insert( fromUTF8( id ), menu );
980 //FIXME parentMenu->insertItem( fromUTF8( text ), menu );
982 connect( menu, SIGNAL( activated ( int ) ),
983 this, SLOT ( sendMenuEvent( int ) ) );
987 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
992 void YQWizard::addMenuEntry( const string & parentMenuID,
994 const string & idString )
996 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1000 int id = _menuEntryIDs.size();
1001 _menuEntryIDs.push_back( idString );
1002 //FIXME parentMenu->insertItem( fromUTF8( text ), id );
1006 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1011 void YQWizard::addMenuSeparator( const string & parentMenuID )
1013 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1017 parentMenu->addSeparator();
1021 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1026 void YQWizard::deleteMenus()
1033 _menuEntryIDs.clear();
1038 void YQWizard::sendMenuEvent( int numID )
1040 if ( numID >= 0 && numID < (int) _menuEntryIDs.size() )
1042 sendEvent( _menuEntryIDs[ numID ] );
1046 y2error( "Invalid menu ID: %d", numID );
1051 void YQWizard::sendEvent( const string & id )
1053 YQUI::ui()->sendEvent( new YMenuEvent( id ) );
1057 int YQWizard::preferredWidth()
1059 return sizeHint().width();
1063 int YQWizard::preferredHeight()
1065 return sizeHint().height();
1069 void YQWizard::setSize( int newWidth, int newHeight )
1071 resize( newWidth, newHeight );
1077 void YQWizard::resizeClientArea()
1079 y2debug( "resizing client area" );
1080 QRect contentsRect = _clientArea->contentsRect();
1081 _contents->setSize( contentsRect.width(), contentsRect.height() );
1084 bool YQWizard::eventFilter( QObject * obj, QEvent * ev )
1086 if ( ev->type() == QEvent::Resize && obj == _contents )
1089 return true; // Event handled
1092 return QWidget::eventFilter( obj, ev );
1096 void YQWizard::setButtonLabel( YPushButton * button, const string & newLabel )
1098 button->setLabel( newLabel );
1099 YDialog::currentDialog()->checkShortcuts();
1101 YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (button);
1104 wizardButton->setVisible( !newLabel.empty() );
1108 void YQWizard::showReleaseNotesButton( const string & label, const string & id )
1110 return; // no longer supported!
1112 if ( ! _releaseNotesButton )
1114 y2error( "NULL Release Notes button" );
1116 if ( ! _stepsPanel )
1117 y2error( "This works only if there is a \"steps\" panel!" );
1122 // no way to check the shortcut, so strip it
1123 _releaseNotesButton->setText( fromUTF8( YShortcut::cleanShortcutString( label ) ) );
1124 _releaseNotesButtonId = id;
1126 _releaseNotesButton->show();
1130 void YQWizard::hideReleaseNotesButton()
1132 if ( _releaseNotesButton && !_releaseNotesButton->isHidden() )
1133 _releaseNotesButton->hide();
1137 void YQWizard::retranslateInternalButtons()
1139 YQUI::setTextdomain( TEXTDOMAIN );
1142 // "Help" button - intentionally without keyboard shortcut
1143 _helpButton->setText( _( "Help" ) );
1146 // "Steps" button - intentionally without keyboard shortcut
1147 _stepsButton->setText( _( "Steps" ) );
1150 // "Tree" button - intentionally without keyboard shortcut
1151 _treeButton->setText( _( "Tree" ) );
1154 void YQWizard::Step::setStatus( Status s )
1156 if ( !_statusLabel || !_nameLabel || _status == s )
1163 _statusLabel->setProperty( "class", "todo-step-status QLabel" );
1164 _nameLabel->setProperty( "class", "todo-step-name QLabel" );
1169 _statusLabel->setProperty( "class", "done-step-status QLabel" );
1170 _nameLabel->setProperty( "class", "done-step-name QLabel" );
1175 _statusLabel->setProperty( "class", "current-step-status QLabel" );
1176 _nameLabel->setProperty( "class", "current-step-name QLabel" );
1179 qApp->style()->polish( _statusLabel );
1180 qApp->style()->polish( _nameLabel );
1183 #include "YQWizard.moc"