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 "QY2Styler.h"
49 #include <QGridLayout>
55 #include "YQApplication.h"
57 #include "YQAlignment.h"
58 #include "YQReplacePoint.h"
61 #include "YQWizardButton.h"
62 #include "YQIconPool.h"
63 #include "YQWidgetFactory.h"
64 #include "YQSignalBlocker.h"
73 #define TEXTDOMAIN "packages-qt"
75 #define USE_ICON_ON_HELP_BUTTON 0
78 YQWizard::YQWizard( YWidget * parent,
79 const string & backButtonLabel,
80 const string & abortButtonLabel,
81 const string & nextButtonLabel,
82 YWizardMode wizardMode )
83 : QFrame( (QWidget *) parent->widgetRep() )
89 , _backButtonLabel( backButtonLabel )
90 , _abortButtonLabel( abortButtonLabel )
91 , _nextButtonLabel( nextButtonLabel )
93 QHBoxLayout* layout = new QHBoxLayout( this );
94 layout->setSpacing( 0 );
95 layout->setMargin( 0 );
99 _stepsEnabled = (wizardMode == YWizardMode_Steps);
100 _treeEnabled = (wizardMode == YWizardMode_Tree);
103 _direction = YQWizard::Forward;
110 _releaseNotesButton = 0;
121 _sendButtonEvents = true;
122 _contentsReplacePoint = 0;
124 //FIXME _stepsList.setAutoDelete( true );
125 //FIXME _stepsIDs.setAutoDelete( false ); // Only for one of both!
127 YQUI::setTextdomain( TEXTDOMAIN );
129 //layoutTitleBar( this );
131 layout->addLayout( layoutSideBar( this ) );
132 layout->addWidget( layoutWorkArea( this ) );
137 YQWizard::~YQWizard()
144 void YQWizard::layoutTitleBar( QWidget * parent )
146 QFrame * titleBar = new QFrame( parent );
147 YUI_CHECK_NEW( titleBar );
149 QHBoxLayout *layout = new QHBoxLayout( titleBar );
150 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert
156 QLabel * left = new QLabel( titleBar );
157 layout->addWidget( left );
158 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
159 left->setObjectName( "titleBar-left" );
162 // Center stretch space
165 layout->addStretch( 10 );
172 QLabel * right = new QLabel( titleBar );
173 YUI_CHECK_NEW( right );
175 layout->addWidget( right );
176 right->setObjectName( "titleBar-right" );
181 QLayout *YQWizard::layoutSideBar( QWidget * parent )
183 _sideBar = new QStackedWidget( parent );
184 YUI_CHECK_NEW( _sideBar );
185 _sideBar->setMinimumWidth( YQUI::ui()->defaultSize( YD_HORIZ ) / 5 );
186 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) ); // hor/vert
188 QVBoxLayout *vbox = new QVBoxLayout( );
189 vbox->addWidget( _sideBar );
198 else if ( _stepsEnabled )
207 void YQWizard::layoutStepsPanel()
210 _stepsPanel = new QFrame( _sideBar );
211 _sideBar->addWidget( _stepsPanel );
212 _sideBar->setObjectName( "steps" );
213 QY2Styler::self()->registerWidget( _sideBar );
214 _stepsPanel->setProperty( "class", "steps QFrame" );
216 // Steps panel bottom buttons ("Help", "Release Notes")
218 // Layouts for the buttons
220 _releaseNotesButton = new QPushButton( _( "Release Notes..." ), _stepsPanel );
221 _releaseNotesButton->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ) ); // hor/vert
223 connect( _releaseNotesButton, SIGNAL( clicked() ),
224 this, SLOT ( releaseNotesClicked() ) );
226 _releaseNotesButton->hide(); // hidden until showReleaseNotesButton() is called
228 _stepsDirty = true; // no layout yet
233 void YQWizard::addStep( const string & text, const string & id )
235 QString qId = fromUTF8( id );
237 if ( _stepsIDs[ qId ] )
239 y2error( "Step ID \"%s\" (\"%s\") already used for \"%s\"",
242 qPrintable( _stepsIDs[ qId ]->name() ) );
246 if ( _stepsList.last() && _stepsList.last()->name() == fromUTF8( text ) )
248 // Consecutive steps with the same name will be shown as one single step.
250 // Since steps are always added at the end of the list, it is
251 // sufficient to check the last step of the list. If the texts are the
252 // same, the other with the same text needs to get another (additional)
253 // ID to make sure setCurrentStep() works as it should.
254 _stepsList.last()->addID( qId );
258 _stepsList.append( new YQWizard::Step( fromUTF8( text ), qId ) );
262 _stepsIDs.insert( qId, _stepsList.last() );
267 void YQWizard::addStepHeading( const string & text )
269 _stepsList.append( new YQWizard::StepHeading( fromUTF8( text ) ) );
275 void YQWizard::updateSteps()
280 // Create a grid layout for the steps
281 QVBoxLayout *_stepsVBox = new QVBoxLayout( _stepsPanel );
283 QGridLayout *_stepsGrid = new QGridLayout( );
284 YUI_CHECK_NEW( _stepsGrid );
285 _stepsVBox->addLayout( _stepsGrid );
286 _stepsGrid->setColumnMinimumWidth( 0, 10 );
287 _stepsGrid->setRowStretch( 0, 1 );
288 _stepsGrid->setRowStretch( 1, 1 );
289 _stepsGrid->setRowStretch( 2, 99 );
291 const int statusCol = 1;
292 const int nameCol = 2;
297 // Create widgets for all steps and step headings in the internal list
300 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
302 YQWizard::Step * step = *i;
303 if ( step->isHeading() )
309 QLabel * label = new QLabel( step->name(), _stepsPanel );
310 YUI_CHECK_NEW( label );
311 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
312 label->setProperty( "class", "steps_heading" );
314 step->setNameLabel( label );
315 _stepsGrid->addWidget( label,
317 1, nameCol - statusCol + 1);
319 else // No heading - ordinary step
325 QLabel * statusLabel = new QLabel( _stepsPanel );
326 YUI_CHECK_NEW( statusLabel );
328 step->setStatusLabel( statusLabel );
329 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
330 _stepsGrid->addWidget( statusLabel, row, statusCol );
336 QLabel * nameLabel = new QLabel( step->name(), _stepsPanel );
337 YUI_CHECK_NEW( nameLabel );
338 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
340 step->setNameLabel( nameLabel );
341 _stepsGrid->addWidget( nameLabel, row, nameCol );
347 _stepsVBox->addStretch( 99 );
348 QVBoxLayout *rbl = new QVBoxLayout();
349 rbl->addWidget( _releaseNotesButton, 0, Qt::AlignCenter );
351 _stepsVBox->addLayout( rbl );
352 _stepsVBox->addStretch( 29 );
358 void YQWizard::updateStepStates()
363 YQWizard::Step * currentStep = findStep( _currentStepID );
364 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
368 // Set status icon and color for the current step
369 currentStep->setStatus( Step::Current );
372 // Set all steps before the current to "done"
375 while ( step != _stepsList.end() && *step != currentStep )
377 ( *step )->setStatus( Step::Done );
381 // Skip the current step - continue with the step after it
383 if ( step != _stepsList.end() )
388 // Set all steps after the current to "to do"
391 while ( step != _stepsList.end() )
393 ( *step )->setStatus( Step::Todo );
398 void YQWizard::setCurrentStep( const string & id )
400 _currentStepID = fromUTF8( id );
405 void YQWizard::deleteSteps()
412 YQWizard::Step * YQWizard::findStep( const QString & id )
417 return _stepsIDs[ id ];
421 void YQWizard::layoutHelpPanel()
426 // Button box with bottom gradient
429 QLabel * buttonBox = new QLabel( _sideBar );
430 YUI_CHECK_NEW( buttonBox );
432 QPushButton * button;
436 // "Tree" button - intentionally without keyboard shortcut
437 button = new QPushButton( _( "Tree" ), buttonBox );
438 YUI_CHECK_NEW( button );
439 _treeButton = button;
440 button->setObjectName( "treeButton" );
445 // "Steps" button - intentionally without keyboard shortcut
446 button = new QPushButton( _( "Steps" ), buttonBox );
447 YUI_CHECK_NEW( button );
448 _stepsButton = button;
449 _stepsButton->hide();
450 _stepsButton->setObjectName( "stepsButton" );
454 // Create a dummy button just to find out how high it would become
455 button = new QPushButton( "Dummy", buttonBox );
456 YUI_CHECK_NEW( button );
459 layoutSideBarButtonBox( buttonBox, button );
463 connect( button, SIGNAL( clicked() ),
464 this, SLOT ( showTree() ) );
466 else if ( _stepsEnabled )
468 connect( button, SIGNAL( clicked() ),
469 this, SLOT ( showSteps() ) );
473 // Hide the dummy button - the button box height is fixed now.
479 void YQWizard::layoutTreePanel()
481 _treePanel = new QFrame( _sideBar );
482 YUI_CHECK_NEW( _treePanel );
483 QHBoxLayout *layout = new QHBoxLayout( _treePanel );
484 _sideBar->addWidget( _treePanel );
486 QVBoxLayout * vbox = new QVBoxLayout();
487 YUI_CHECK_NEW( vbox );
488 layout->addLayout( vbox );
492 _tree = new QY2ListView( _treePanel );
493 YUI_CHECK_NEW( _tree );
494 vbox->addWidget( _tree );
497 // _tree->addColumn( "" );
498 // _tree->header()->hide();
500 _tree->setRootIsDecorated( true );
501 _tree->setSortByInsertionSequence( true );
503 connect( _tree, SIGNAL( itemSelectionChanged ( void ) ),
504 this, SLOT ( treeSelectionChanged ( void ) ) );
506 connect( _tree, SIGNAL( spacePressed ( QTreeWidgetItem * ) ),
507 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
509 connect( _tree, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int ) ),
510 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
515 void YQWizard::addTreeItem( const string & parentID, const string & text, const string & id )
517 QString qId = fromUTF8( id );
521 y2error( "YQWizard widget not created with `opt(`treeEnabled) !" );
525 YQWizard::TreeItem * item = 0;
526 YQWizard::TreeItem * parent = 0;
528 if ( ! parentID.empty() )
530 parent = findTreeItem( parentID );
535 item = new YQWizard::TreeItem( parent, fromUTF8( text ), qId );
536 YUI_CHECK_NEW( item );
540 item = new YQWizard::TreeItem( _tree, fromUTF8( text ), qId );
541 YUI_CHECK_NEW( item );
544 if ( ! qId.isEmpty() )
545 _treeIDs.insert( qId, item );
550 void YQWizard::deleteTreeItems()
560 YQWizard::TreeItem * YQWizard::findTreeItem( const string & id )
565 return _treeIDs[ fromUTF8( id ) ];
569 void YQWizard::selectTreeItem( const string & id )
573 YQWizard::TreeItem * item = findTreeItem( id );
577 YQSignalBlocker sigBlocker( _tree );
579 _tree->setCurrentItem(item);
580 _tree->scrollToItem(item);
586 void YQWizard::sendTreeEvent( QTreeWidgetItem * listViewItem )
590 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> ( listViewItem );
592 if ( item && ! item->id().isEmpty() )
593 sendEvent( toUTF8( item->id() ) );
598 void YQWizard::treeSelectionChanged()
599 { //FIXME is currentItem correct or selected.first
601 sendTreeEvent( _tree->currentItem() );
605 string YQWizard::currentTreeSelection()
609 QTreeWidgetItem * sel = _tree->currentItem();
613 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> (sel);
615 if ( item && ! item->id().isEmpty() )
616 return toUTF8( item->id() );
625 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
627 QFrame *workArea = new QFrame( parent );
628 workArea->setObjectName( "work_area" );
630 QY2Styler::self()->registerWidget( workArea );
632 QVBoxLayout *vbox = new QVBoxLayout( workArea );
634 _menuBar = new QMenuBar( workArea );
635 YUI_CHECK_NEW( _menuBar );
637 _menuBar->hide(); // will be made visible when menus are added
638 vbox->addWidget( _menuBar );
641 // Dialog icon and heading
644 QHBoxLayout * headingHBox = new QHBoxLayout();
645 YUI_CHECK_NEW( headingHBox );
646 //headingHBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
647 vbox->addLayout( headingHBox );
649 _dialogIcon = new QLabel( workArea );
650 YUI_CHECK_NEW( _dialogIcon );
651 headingHBox->addWidget( _dialogIcon );
652 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); // hor/vert
653 _dialogIcon->setObjectName( "DialogIcon" );
655 _dialogHeading = new QLabel( workArea );
656 YUI_CHECK_NEW( _dialogHeading );
657 headingHBox->addWidget( _dialogHeading );
658 _dialogHeading->setAlignment( Qt::AlignLeft );
659 _dialogHeading->setWordWrap( true );
660 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
661 _dialogHeading->setObjectName( "DialogHeading" );
664 // Client area (the part that belongs to the YCP application)
667 layoutClientArea( workArea );
668 vbox->addWidget( _clientArea );
674 QLayout *bb = layoutButtonBox( workArea );
675 vbox->addLayout( bb );
682 void YQWizard::layoutClientArea( QWidget * parent )
684 _clientArea = new QFrame( parent );
685 YUI_CHECK_NEW( _clientArea );
686 QVBoxLayout *layout = new QVBoxLayout( _clientArea );
687 // _clientArea->layout()->setMargin( 4 );
690 // HVCenter for wizard contents
693 _contents = new YQAlignment( this, _clientArea, YAlignCenter, YAlignCenter );
694 YUI_CHECK_NEW( _contents );
695 layout->addWidget( _contents );
696 _contents->QObject::setProperty( "class", "Contents" );
698 _contents->setStretchable( YD_HORIZ, true );
699 _contents->setStretchable( YD_VERT, true );
700 _contents->installEventFilter( this );
701 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // hor/vert
704 // Replace point for wizard contents
707 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
710 // Initial YEmpty widget contents of replace point
713 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
714 _contentsReplacePoint->showChild();
720 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
723 // QHBoxLayout for the buttons
726 QHBoxLayout * hbox = new QHBoxLayout(); // parent, spacing
727 YUI_CHECK_NEW( hbox );
729 hbox->setSpacing( 0 );
730 hbox->setMargin( 0 );
732 // Help button - intentionally without keyboard shortcut
733 _helpButton = new QPushButton( _( "Help" ), parent );
734 YUI_CHECK_NEW( _helpButton );
736 connect( _helpButton, SIGNAL( clicked() ),
737 this, SLOT ( showHelp() ) );
739 hbox->addWidget( _helpButton );
741 hbox->addStretch( 10 );
747 _abortButton = new YQWizardButton( this, parent, _abortButtonLabel );
748 YUI_CHECK_NEW( _abortButton );
750 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
751 connect( _abortButton, SIGNAL( clicked() ),
752 this, SLOT ( slotAbortClicked() ) );
754 hbox->addSpacing( 10 );
760 _backButton = new YQWizardButton( this, parent, _backButtonLabel );
761 YUI_CHECK_NEW( _backButton );
763 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
764 connect( _backButton, SIGNAL( clicked() ),
765 this, SLOT ( slotBackClicked() ) );
767 if ( _backButton->text().isEmpty() )
774 hbox->addSpacing( 5 );
776 _nextButton = new YQWizardButton( this, parent, _nextButtonLabel );
777 YUI_CHECK_NEW( _nextButton );
779 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
780 connect( _nextButton, SIGNAL( clicked() ),
781 this, SLOT ( slotNextClicked() ) );
786 void YQWizard::destroyButtons()
799 void YQWizard::connectNotify ( const char * signal )
801 if ( QString( signal ).contains( "nextClicked()" ) )
803 y2debug( "nextClicked connected, no longer directly sending button events" );
804 _sendButtonEvents = false;
809 void YQWizard::disconnectNotify ( const char * signal )
811 if ( QString( signal ).contains( "nextClicked()" ) )
813 y2debug( "nextClicked disconnected, directly sending button events again" );
814 _sendButtonEvents = true;
819 void YQWizard::setDialogIcon( const string & iconName )
823 if ( ! iconName.empty() )
825 QPixmap icon( iconName.c_str() );
828 y2warning( "Couldn't load dialog icon \"%s\"", iconName.c_str() );
831 _dialogIcon->setPixmap( icon );
832 topLevelWidget()->setWindowIcon( icon );
837 _dialogIcon->clear();
838 topLevelWidget()->setWindowIcon( QIcon() );
844 void YQWizard::setDialogHeading( const string & headingText )
846 if ( _dialogHeading )
848 if ( ! headingText.empty() )
849 _dialogHeading->setText( fromUTF8( headingText ) );
851 _dialogHeading->clear();
855 string YQWizard::debugLabel()
857 if ( _dialogHeading )
859 QString label = _dialogHeading->text();
860 label = label.simplified(); // Replace any embedded newline with a single blank
862 if ( ! label.isEmpty() )
864 label.prepend( "YQWizard \"" );
865 label.append( "\"" );
867 return toUTF8( label );
871 return "untitled YQWizard";
874 void YQWizard::setHelpText( const string & helpText )
876 _qHelpText = fromUTF8( helpText );
877 _qHelpText.replace( "&product;", YQUI::ui()->productName() );
881 void YQWizard::slotBackClicked()
885 if ( _sendButtonEvents )
886 YQUI::ui()->sendEvent( new YWidgetEvent( _backButton, YEvent::Activated ) );
888 _direction = YQWizard::Backward;
892 void YQWizard::slotAbortClicked()
896 if ( _sendButtonEvents )
897 YQUI::ui()->sendEvent( new YWidgetEvent( _abortButton, YEvent::Activated ) );
901 void YQWizard::slotNextClicked()
905 if ( _sendButtonEvents )
906 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
908 _direction = YQWizard::Forward;
912 void YQWizard::showHelp()
914 QDialog helpDlg( this );
916 ui.setupUi( &helpDlg );
917 ui.textBrowser->setText( _qHelpText );
922 void YQWizard::releaseNotesClicked()
924 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
926 if ( ! _releaseNotesButtonId.empty() )
928 y2milestone( "Release Notes button clicked" );
929 sendEvent( _releaseNotesButtonId );
934 void YQWizard::showSteps()
936 if ( _sideBar && _stepsPanel )
938 _sideBar->setCurrentWidget( _stepsPanel );
943 void YQWizard::showTree()
945 if ( _sideBar && _treePanel )
947 _sideBar->setCurrentWidget( _treePanel );
953 void YQWizard::addMenu( const string & text,
958 QMenu * menu = new QMenu( _menuBar );
959 YUI_CHECK_NEW( menu );
961 _menuIDs.insert( fromUTF8( id ), menu );
962 //FIXME _menuBar->insertItem( fromUTF8( text ), menu );
964 connect( menu, SIGNAL( activated ( int ) ),
965 this, SLOT ( sendMenuEvent( int ) ) );
972 void YQWizard::addSubMenu( const string & parentMenuID,
976 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
980 QMenu * menu = new QMenu( _menuBar );
981 YUI_CHECK_NEW( menu );
983 _menuIDs.insert( fromUTF8( id ), menu );
984 //FIXME parentMenu->insertItem( fromUTF8( text ), menu );
986 connect( menu, SIGNAL( activated ( int ) ),
987 this, SLOT ( sendMenuEvent( int ) ) );
991 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
996 void YQWizard::addMenuEntry( const string & parentMenuID,
998 const string & idString )
1000 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1004 int id = _menuEntryIDs.size();
1005 _menuEntryIDs.push_back( idString );
1006 //FIXME parentMenu->insertItem( fromUTF8( text ), id );
1010 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1015 void YQWizard::addMenuSeparator( const string & parentMenuID )
1017 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1021 parentMenu->addSeparator();
1025 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1030 void YQWizard::deleteMenus()
1037 _menuEntryIDs.clear();
1042 void YQWizard::sendMenuEvent( int numID )
1044 if ( numID >= 0 && numID < (int) _menuEntryIDs.size() )
1046 sendEvent( _menuEntryIDs[ numID ] );
1050 y2error( "Invalid menu ID: %d", numID );
1055 void YQWizard::sendEvent( const string & id )
1057 YQUI::ui()->sendEvent( new YMenuEvent( id ) );
1061 int YQWizard::preferredWidth()
1063 return sizeHint().width();
1067 int YQWizard::preferredHeight()
1069 return sizeHint().height();
1073 void YQWizard::setSize( int newWidth, int newHeight )
1075 resize( newWidth, newHeight );
1081 void YQWizard::resizeClientArea()
1083 y2debug( "resizing client area" );
1084 QRect contentsRect = _clientArea->contentsRect();
1085 _contents->setSize( contentsRect.width(), contentsRect.height() );
1088 bool YQWizard::eventFilter( QObject * obj, QEvent * ev )
1090 if ( ev->type() == QEvent::Resize && obj == _contents )
1093 return true; // Event handled
1096 return QWidget::eventFilter( obj, ev );
1100 void YQWizard::setButtonLabel( YPushButton * button, const string & newLabel )
1102 button->setLabel( newLabel );
1103 YDialog::currentDialog()->checkShortcuts();
1105 YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (button);
1108 wizardButton->setVisible( !newLabel.empty() );
1112 void YQWizard::showReleaseNotesButton( const string & label, const string & id )
1114 return; // no longer supported!
1116 if ( ! _releaseNotesButton )
1118 y2error( "NULL Release Notes button" );
1120 if ( ! _stepsPanel )
1121 y2error( "This works only if there is a \"steps\" panel!" );
1126 // no way to check the shortcut, so strip it
1127 _releaseNotesButton->setText( fromUTF8( YShortcut::cleanShortcutString( label ) ) );
1128 _releaseNotesButtonId = id;
1130 _releaseNotesButton->show();
1134 void YQWizard::hideReleaseNotesButton()
1136 if ( _releaseNotesButton && !_releaseNotesButton->isHidden() )
1137 _releaseNotesButton->hide();
1141 void YQWizard::retranslateInternalButtons()
1143 YQUI::setTextdomain( TEXTDOMAIN );
1146 // "Help" button - intentionally without keyboard shortcut
1147 _helpButton->setText( _( "Help" ) );
1150 // "Steps" button - intentionally without keyboard shortcut
1151 _stepsButton->setText( _( "Steps" ) );
1154 // "Tree" button - intentionally without keyboard shortcut
1155 _treeButton->setText( _( "Tree" ) );
1158 void YQWizard::Step::setStatus( Status s )
1160 if ( !_statusLabel || !_nameLabel || _status == s )
1167 _statusLabel->setProperty( "class", "todo-step-status QLabel" );
1168 _nameLabel->setProperty( "class", "todo-step-name QLabel" );
1173 _statusLabel->setProperty( "class", "done-step-status QLabel" );
1174 _nameLabel->setProperty( "class", "done-step-name QLabel" );
1179 _statusLabel->setProperty( "class", "current-step-status QLabel" );
1180 _nameLabel->setProperty( "class", "current-step-name QLabel" );
1183 qApp->style()->polish( _statusLabel );
1184 qApp->style()->polish( _nameLabel );
1187 #include "YQWizard.moc"