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 setObjectName( "wizard" );
95 QHBoxLayout* layout = new QHBoxLayout( this );
96 layout->setSpacing( 0 );
97 layout->setMargin( 0 );
101 _stepsEnabled = (wizardMode == YWizardMode_Steps);
102 _treeEnabled = (wizardMode == YWizardMode_Tree);
105 _direction = YQWizard::Forward;
112 _releaseNotesButton = 0;
123 _sendButtonEvents = true;
124 _contentsReplacePoint = 0;
126 //FIXME _stepsList.setAutoDelete( true );
127 //FIXME _stepsIDs.setAutoDelete( false ); // Only for one of both!
129 YQUI::setTextdomain( TEXTDOMAIN );
131 //layoutTitleBar( this );
133 layout->addLayout( layoutSideBar( this ) );
134 layout->addWidget( layoutWorkArea( this ) );
136 QY2Styler::self()->registerWidget( this );
141 YQWizard::~YQWizard()
148 void YQWizard::layoutTitleBar( QWidget * parent )
150 QFrame * titleBar = new QFrame( parent );
151 YUI_CHECK_NEW( titleBar );
153 QHBoxLayout *layout = new QHBoxLayout( titleBar );
154 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert
160 QLabel * left = new QLabel( titleBar );
161 layout->addWidget( left );
162 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
163 left->setObjectName( "titleBar-left" );
166 // Center stretch space
169 layout->addStretch( 10 );
176 QLabel * right = new QLabel( titleBar );
177 YUI_CHECK_NEW( right );
179 layout->addWidget( right );
180 right->setObjectName( "titleBar-right" );
185 QLayout *YQWizard::layoutSideBar( QWidget * parent )
187 _sideBar = new QStackedWidget( parent );
188 YUI_CHECK_NEW( _sideBar );
189 _sideBar->setMinimumWidth( YQUI::ui()->defaultSize( YD_HORIZ ) / 5 );
190 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) ); // hor/vert
192 QVBoxLayout *vbox = new QVBoxLayout( );
193 vbox->addWidget( _sideBar );
202 else if ( _stepsEnabled )
211 void YQWizard::layoutStepsPanel()
214 _stepsPanel = new QFrame( _sideBar );
215 _sideBar->addWidget( _stepsPanel );
216 _sideBar->setObjectName( "steps" );
217 QY2Styler::self()->registerWidget( _sideBar );
218 _stepsPanel->setProperty( "class", "steps QFrame" );
220 // Steps panel bottom buttons ("Help", "Release Notes")
222 // Layouts for the buttons
224 _releaseNotesButton = new QPushButton( _( "Release Notes..." ), _stepsPanel );
225 _releaseNotesButton->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ) ); // hor/vert
227 connect( _releaseNotesButton, SIGNAL( clicked() ),
228 this, SLOT ( releaseNotesClicked() ) );
230 _releaseNotesButton->hide(); // hidden until showReleaseNotesButton() is called
232 _stepsDirty = true; // no layout yet
237 void YQWizard::addStep( const string & text, const string & id )
239 QString qId = fromUTF8( id );
241 if ( _stepsIDs[ qId ] )
243 y2error( "Step ID \"%s\" (\"%s\") already used for \"%s\"",
246 qPrintable( _stepsIDs[ qId ]->name() ) );
250 if ( _stepsList.last() && _stepsList.last()->name() == fromUTF8( text ) )
252 // Consecutive steps with the same name will be shown as one single step.
254 // Since steps are always added at the end of the list, it is
255 // sufficient to check the last step of the list. If the texts are the
256 // same, the other with the same text needs to get another (additional)
257 // ID to make sure setCurrentStep() works as it should.
258 _stepsList.last()->addID( qId );
262 _stepsList.append( new YQWizard::Step( fromUTF8( text ), qId ) );
266 _stepsIDs.insert( qId, _stepsList.last() );
271 void YQWizard::addStepHeading( const string & text )
273 _stepsList.append( new YQWizard::StepHeading( fromUTF8( text ) ) );
279 void YQWizard::updateSteps()
284 // Create a grid layout for the steps
285 QVBoxLayout *_stepsVBox = new QVBoxLayout( _stepsPanel );
287 QGridLayout *_stepsGrid = new QGridLayout( );
288 YUI_CHECK_NEW( _stepsGrid );
289 _stepsVBox->addLayout( _stepsGrid );
290 _stepsGrid->setColumnMinimumWidth( 0, 10 );
291 _stepsGrid->setRowStretch( 0, 1 );
292 _stepsGrid->setRowStretch( 1, 1 );
293 _stepsGrid->setRowStretch( 2, 99 );
295 const int statusCol = 1;
296 const int nameCol = 2;
301 // Create widgets for all steps and step headings in the internal list
304 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
306 YQWizard::Step * step = *i;
307 if ( step->isHeading() )
313 QLabel * label = new QLabel( step->name(), _stepsPanel );
314 YUI_CHECK_NEW( label );
315 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
316 label->setProperty( "class", "steps_heading" );
318 step->setNameLabel( label );
319 _stepsGrid->addWidget( label,
321 1, nameCol - statusCol + 1);
323 else // No heading - ordinary step
329 QLabel * statusLabel = new QLabel( _stepsPanel );
330 YUI_CHECK_NEW( statusLabel );
332 step->setStatusLabel( statusLabel );
333 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
334 _stepsGrid->addWidget( statusLabel, row, statusCol );
340 QLabel * nameLabel = new QLabel( step->name(), _stepsPanel );
341 YUI_CHECK_NEW( nameLabel );
342 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
344 step->setNameLabel( nameLabel );
345 _stepsGrid->addWidget( nameLabel, row, nameCol );
351 _stepsVBox->addStretch( 99 );
352 QVBoxLayout *rbl = new QVBoxLayout();
353 rbl->addWidget( _releaseNotesButton, 0, Qt::AlignCenter );
355 _stepsVBox->addLayout( rbl );
356 _stepsVBox->addStretch( 29 );
362 void YQWizard::updateStepStates()
367 YQWizard::Step * currentStep = findStep( _currentStepID );
368 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
372 // Set status icon and color for the current step
373 currentStep->setStatus( Step::Current );
376 // Set all steps before the current to "done"
379 while ( step != _stepsList.end() && *step != currentStep )
381 ( *step )->setStatus( Step::Done );
385 // Skip the current step - continue with the step after it
387 if ( step != _stepsList.end() )
392 // Set all steps after the current to "to do"
395 while ( step != _stepsList.end() )
397 ( *step )->setStatus( Step::Todo );
402 void YQWizard::setCurrentStep( const string & id )
404 _currentStepID = fromUTF8( id );
409 void YQWizard::deleteSteps()
416 YQWizard::Step * YQWizard::findStep( const QString & id )
421 return _stepsIDs[ id ];
425 void YQWizard::layoutHelpPanel()
430 // Button box with bottom gradient
433 QLabel * buttonBox = new QLabel( _sideBar );
434 YUI_CHECK_NEW( buttonBox );
436 QPushButton * button;
440 // "Tree" button - intentionally without keyboard shortcut
441 button = new QPushButton( _( "Tree" ), buttonBox );
442 YUI_CHECK_NEW( button );
443 _treeButton = button;
444 button->setObjectName( "treeButton" );
449 // "Steps" button - intentionally without keyboard shortcut
450 button = new QPushButton( _( "Steps" ), buttonBox );
451 YUI_CHECK_NEW( button );
452 _stepsButton = button;
453 _stepsButton->hide();
454 _stepsButton->setObjectName( "stepsButton" );
458 // Create a dummy button just to find out how high it would become
459 button = new QPushButton( "Dummy", buttonBox );
460 YUI_CHECK_NEW( button );
463 layoutSideBarButtonBox( buttonBox, button );
467 connect( button, SIGNAL( clicked() ),
468 this, SLOT ( showTree() ) );
470 else if ( _stepsEnabled )
472 connect( button, SIGNAL( clicked() ),
473 this, SLOT ( showSteps() ) );
477 // Hide the dummy button - the button box height is fixed now.
483 void YQWizard::layoutTreePanel()
485 _treePanel = new QFrame( _sideBar );
486 YUI_CHECK_NEW( _treePanel );
487 QHBoxLayout *layout = new QHBoxLayout( _treePanel );
488 _sideBar->addWidget( _treePanel );
490 QVBoxLayout * vbox = new QVBoxLayout();
491 YUI_CHECK_NEW( vbox );
492 layout->addLayout( vbox );
496 _tree = new QY2ListView( _treePanel );
497 YUI_CHECK_NEW( _tree );
498 vbox->addWidget( _tree );
501 // _tree->addColumn( "" );
502 // _tree->header()->hide();
504 _tree->setRootIsDecorated( true );
505 _tree->setSortByInsertionSequence( true );
507 connect( _tree, SIGNAL( itemSelectionChanged ( void ) ),
508 this, SLOT ( treeSelectionChanged ( void ) ) );
510 connect( _tree, SIGNAL( spacePressed ( QTreeWidgetItem * ) ),
511 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
513 connect( _tree, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int ) ),
514 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
519 void YQWizard::addTreeItem( const string & parentID, const string & text, const string & id )
521 QString qId = fromUTF8( id );
525 y2error( "YQWizard widget not created with `opt(`treeEnabled) !" );
529 YQWizard::TreeItem * item = 0;
530 YQWizard::TreeItem * parent = 0;
532 if ( ! parentID.empty() )
534 parent = findTreeItem( parentID );
539 item = new YQWizard::TreeItem( parent, fromUTF8( text ), qId );
540 YUI_CHECK_NEW( item );
544 item = new YQWizard::TreeItem( _tree, fromUTF8( text ), qId );
545 YUI_CHECK_NEW( item );
548 if ( ! qId.isEmpty() )
549 _treeIDs.insert( qId, item );
554 void YQWizard::deleteTreeItems()
564 YQWizard::TreeItem * YQWizard::findTreeItem( const string & id )
569 return _treeIDs[ fromUTF8( id ) ];
573 void YQWizard::selectTreeItem( const string & id )
577 YQWizard::TreeItem * item = findTreeItem( id );
581 YQSignalBlocker sigBlocker( _tree );
583 _tree->setCurrentItem(item);
584 _tree->scrollToItem(item);
590 void YQWizard::sendTreeEvent( QTreeWidgetItem * listViewItem )
594 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> ( listViewItem );
596 if ( item && ! item->id().isEmpty() )
597 sendEvent( toUTF8( item->id() ) );
602 void YQWizard::treeSelectionChanged()
603 { //FIXME is currentItem correct or selected.first
605 sendTreeEvent( _tree->currentItem() );
609 string YQWizard::currentTreeSelection()
613 QTreeWidgetItem * sel = _tree->currentItem();
617 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> (sel);
619 if ( item && ! item->id().isEmpty() )
620 return toUTF8( item->id() );
629 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
631 QFrame *workArea = new QFrame( parent );
632 workArea->setObjectName( "work_area" );
634 QY2Styler::self()->registerWidget( workArea );
636 QVBoxLayout *vbox = new QVBoxLayout( workArea );
638 _menuBar = new QMenuBar( workArea );
639 YUI_CHECK_NEW( _menuBar );
641 _menuBar->hide(); // will be made visible when menus are added
642 vbox->addWidget( _menuBar );
645 // Dialog icon and heading
648 QHBoxLayout * headingHBox = new QHBoxLayout();
649 YUI_CHECK_NEW( headingHBox );
650 //headingHBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
651 vbox->addLayout( headingHBox );
653 _dialogIcon = new QLabel( workArea );
654 YUI_CHECK_NEW( _dialogIcon );
655 headingHBox->addWidget( _dialogIcon );
656 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); // hor/vert
657 _dialogIcon->setObjectName( "DialogIcon" );
659 _dialogHeading = new QLabel( workArea );
660 YUI_CHECK_NEW( _dialogHeading );
661 headingHBox->addWidget( _dialogHeading );
662 _dialogHeading->setAlignment( Qt::AlignLeft );
663 _dialogHeading->setWordWrap( true );
664 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
665 _dialogHeading->setObjectName( "DialogHeading" );
668 // Client area (the part that belongs to the YCP application)
671 layoutClientArea( workArea );
672 vbox->addWidget( _clientArea );
678 QLayout *bb = layoutButtonBox( workArea );
679 vbox->addLayout( bb );
686 void YQWizard::layoutClientArea( QWidget * parent )
688 _clientArea = new QFrame( parent );
689 YUI_CHECK_NEW( _clientArea );
690 QVBoxLayout *layout = new QVBoxLayout( _clientArea );
691 // _clientArea->layout()->setMargin( 4 );
694 // HVCenter for wizard contents
697 _contents = new YQAlignment( this, _clientArea, YAlignCenter, YAlignCenter );
698 YUI_CHECK_NEW( _contents );
699 layout->addWidget( _contents );
700 _contents->QObject::setProperty( "class", "Contents" );
702 _contents->setStretchable( YD_HORIZ, true );
703 _contents->setStretchable( YD_VERT, true );
704 _contents->installEventFilter( this );
705 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // hor/vert
708 // Replace point for wizard contents
711 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
714 // Initial YEmpty widget contents of replace point
717 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
718 _contentsReplacePoint->showChild();
724 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
727 // QHBoxLayout for the buttons
730 QHBoxLayout * hbox = new QHBoxLayout(); // parent, spacing
731 YUI_CHECK_NEW( hbox );
733 hbox->setSpacing( 0 );
734 hbox->setMargin( 0 );
736 // Help button - intentionally without keyboard shortcut
737 _helpButton = new QPushButton( _( "Help" ), parent );
738 YUI_CHECK_NEW( _helpButton );
740 connect( _helpButton, SIGNAL( clicked() ),
741 this, SLOT ( showHelp() ) );
743 hbox->addWidget( _helpButton );
745 hbox->addStretch( 10 );
751 _abortButton = new YQWizardButton( this, parent, _abortButtonLabel );
752 YUI_CHECK_NEW( _abortButton );
754 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
755 connect( _abortButton, SIGNAL( clicked() ),
756 this, SLOT ( slotAbortClicked() ) );
758 hbox->addSpacing( 10 );
764 _backButton = new YQWizardButton( this, parent, _backButtonLabel );
765 YUI_CHECK_NEW( _backButton );
767 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
768 connect( _backButton, SIGNAL( clicked() ),
769 this, SLOT ( slotBackClicked() ) );
771 if ( _backButton->text().isEmpty() )
778 hbox->addSpacing( 5 );
780 _nextButton = new YQWizardButton( this, parent, _nextButtonLabel );
781 YUI_CHECK_NEW( _nextButton );
783 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
784 connect( _nextButton, SIGNAL( clicked() ),
785 this, SLOT ( slotNextClicked() ) );
790 void YQWizard::destroyButtons()
803 void YQWizard::connectNotify ( const char * signal )
805 if ( QString( signal ).contains( "nextClicked()" ) )
807 y2debug( "nextClicked connected, no longer directly sending button events" );
808 _sendButtonEvents = false;
813 void YQWizard::disconnectNotify ( const char * signal )
815 if ( QString( signal ).contains( "nextClicked()" ) )
817 y2debug( "nextClicked disconnected, directly sending button events again" );
818 _sendButtonEvents = true;
823 void YQWizard::setDialogIcon( const string & iconName )
827 if ( ! iconName.empty() )
829 QPixmap icon( iconName.c_str() );
832 y2warning( "Couldn't load dialog icon \"%s\"", iconName.c_str() );
835 _dialogIcon->setPixmap( icon );
836 topLevelWidget()->setWindowIcon( icon );
841 _dialogIcon->clear();
842 topLevelWidget()->setWindowIcon( QIcon() );
848 void YQWizard::setDialogHeading( const string & headingText )
850 if ( _dialogHeading )
852 if ( ! headingText.empty() )
853 _dialogHeading->setText( fromUTF8( headingText ) );
855 _dialogHeading->clear();
859 string YQWizard::debugLabel()
861 if ( _dialogHeading )
863 QString label = _dialogHeading->text();
864 label = label.simplified(); // Replace any embedded newline with a single blank
866 if ( ! label.isEmpty() )
868 label.prepend( "YQWizard \"" );
869 label.append( "\"" );
871 return toUTF8( label );
875 return "untitled YQWizard";
878 void YQWizard::setHelpText( const string & helpText )
880 _qHelpText = fromUTF8( helpText );
881 _qHelpText.replace( "&product;", YQUI::ui()->productName() );
885 void YQWizard::slotBackClicked()
889 if ( _sendButtonEvents )
890 YQUI::ui()->sendEvent( new YWidgetEvent( _backButton, YEvent::Activated ) );
892 _direction = YQWizard::Backward;
896 void YQWizard::slotAbortClicked()
900 if ( _sendButtonEvents )
901 YQUI::ui()->sendEvent( new YWidgetEvent( _abortButton, YEvent::Activated ) );
905 void YQWizard::slotNextClicked()
909 if ( _sendButtonEvents )
910 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
912 _direction = YQWizard::Forward;
916 void YQWizard::showHelp()
918 QDialog helpDlg( this );
920 ui.setupUi( &helpDlg );
921 ui.textBrowser->setText( _qHelpText );
926 void YQWizard::releaseNotesClicked()
928 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
930 if ( ! _releaseNotesButtonId.empty() )
932 y2milestone( "Release Notes button clicked" );
933 sendEvent( _releaseNotesButtonId );
938 void YQWizard::showSteps()
940 if ( _sideBar && _stepsPanel )
942 _sideBar->setCurrentWidget( _stepsPanel );
947 void YQWizard::showTree()
949 if ( _sideBar && _treePanel )
951 _sideBar->setCurrentWidget( _treePanel );
957 void YQWizard::addMenu( const string & text,
962 QMenu * menu = new QMenu( _menuBar );
963 YUI_CHECK_NEW( menu );
965 _menuIDs.insert( fromUTF8( id ), menu );
966 //FIXME _menuBar->insertItem( fromUTF8( text ), menu );
968 connect( menu, SIGNAL( activated ( int ) ),
969 this, SLOT ( sendMenuEvent( int ) ) );
976 void YQWizard::addSubMenu( const string & parentMenuID,
980 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
984 QMenu * menu = new QMenu( _menuBar );
985 YUI_CHECK_NEW( menu );
987 _menuIDs.insert( fromUTF8( id ), menu );
988 //FIXME parentMenu->insertItem( fromUTF8( text ), menu );
990 connect( menu, SIGNAL( activated ( int ) ),
991 this, SLOT ( sendMenuEvent( int ) ) );
995 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1000 void YQWizard::addMenuEntry( const string & parentMenuID,
1001 const string & text,
1002 const string & idString )
1004 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1008 int id = _menuEntryIDs.size();
1009 _menuEntryIDs.push_back( idString );
1010 //FIXME parentMenu->insertItem( fromUTF8( text ), id );
1014 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1019 void YQWizard::addMenuSeparator( const string & parentMenuID )
1021 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1025 parentMenu->addSeparator();
1029 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1034 void YQWizard::deleteMenus()
1041 _menuEntryIDs.clear();
1046 void YQWizard::sendMenuEvent( int numID )
1048 if ( numID >= 0 && numID < (int) _menuEntryIDs.size() )
1050 sendEvent( _menuEntryIDs[ numID ] );
1054 y2error( "Invalid menu ID: %d", numID );
1059 void YQWizard::sendEvent( const string & id )
1061 YQUI::ui()->sendEvent( new YMenuEvent( id ) );
1065 int YQWizard::preferredWidth()
1067 return sizeHint().width();
1071 int YQWizard::preferredHeight()
1073 return sizeHint().height();
1077 void YQWizard::setSize( int newWidth, int newHeight )
1079 resize( newWidth, newHeight );
1085 void YQWizard::resizeClientArea()
1087 y2debug( "resizing client area" );
1088 QRect contentsRect = _clientArea->contentsRect();
1089 _contents->setSize( contentsRect.width(), contentsRect.height() );
1092 bool YQWizard::eventFilter( QObject * obj, QEvent * ev )
1094 if ( ev->type() == QEvent::Resize && obj == _contents )
1097 return true; // Event handled
1100 return QWidget::eventFilter( obj, ev );
1104 void YQWizard::setButtonLabel( YPushButton * button, const string & newLabel )
1106 button->setLabel( newLabel );
1107 YDialog::currentDialog()->checkShortcuts();
1109 YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (button);
1112 wizardButton->setVisible( !newLabel.empty() );
1116 void YQWizard::showReleaseNotesButton( const string & label, const string & id )
1118 return; // no longer supported!
1120 if ( ! _releaseNotesButton )
1122 y2error( "NULL Release Notes button" );
1124 if ( ! _stepsPanel )
1125 y2error( "This works only if there is a \"steps\" panel!" );
1130 // no way to check the shortcut, so strip it
1131 _releaseNotesButton->setText( fromUTF8( YShortcut::cleanShortcutString( label ) ) );
1132 _releaseNotesButtonId = id;
1134 _releaseNotesButton->show();
1138 void YQWizard::hideReleaseNotesButton()
1140 if ( _releaseNotesButton && !_releaseNotesButton->isHidden() )
1141 _releaseNotesButton->hide();
1145 void YQWizard::retranslateInternalButtons()
1147 YQUI::setTextdomain( TEXTDOMAIN );
1150 // "Help" button - intentionally without keyboard shortcut
1151 _helpButton->setText( _( "Help" ) );
1154 // "Steps" button - intentionally without keyboard shortcut
1155 _stepsButton->setText( _( "Steps" ) );
1158 // "Tree" button - intentionally without keyboard shortcut
1159 _treeButton->setText( _( "Tree" ) );
1162 void YQWizard::Step::setStatus( Status s )
1164 if ( !_statusLabel || !_nameLabel || _status == s )
1171 _statusLabel->setProperty( "class", "todo-step-status QLabel" );
1172 _nameLabel->setProperty( "class", "todo-step-name QLabel" );
1177 _statusLabel->setProperty( "class", "done-step-status QLabel" );
1178 _nameLabel->setProperty( "class", "done-step-name QLabel" );
1183 _statusLabel->setProperty( "class", "current-step-status QLabel" );
1184 _nameLabel->setProperty( "class", "current-step-name QLabel" );
1187 qApp->style()->polish( _statusLabel );
1188 qApp->style()->polish( _nameLabel );
1191 #include "YQWizard.moc"