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 YQUI::setTextdomain( TEXTDOMAIN );
128 //layoutTitleBar( this );
130 layout->addLayout( layoutSideBar( this ) );
131 layout->addWidget( layoutWorkArea( this ) );
133 QY2Styler::self()->registerWidget( this );
138 YQWizard::~YQWizard()
145 void YQWizard::layoutTitleBar( QWidget * parent )
147 QFrame * titleBar = new QFrame( parent );
148 YUI_CHECK_NEW( titleBar );
150 QHBoxLayout *layout = new QHBoxLayout( titleBar );
151 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert
157 QLabel * left = new QLabel( titleBar );
158 layout->addWidget( left );
159 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
160 left->setObjectName( "titleBar-left" );
163 // Center stretch space
166 layout->addStretch( 10 );
173 QLabel * right = new QLabel( titleBar );
174 YUI_CHECK_NEW( right );
176 layout->addWidget( right );
177 right->setObjectName( "titleBar-right" );
182 QLayout *YQWizard::layoutSideBar( QWidget * parent )
184 _sideBar = new QStackedWidget( parent );
185 YUI_CHECK_NEW( _sideBar );
186 _sideBar->setMinimumWidth( YQUI::ui()->defaultSize( YD_HORIZ ) / 5 );
187 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) ); // hor/vert
189 QVBoxLayout *vbox = new QVBoxLayout( );
190 vbox->addWidget( _sideBar );
199 else if ( _stepsEnabled )
208 void YQWizard::layoutStepsPanel()
211 _stepsPanel = new QFrame( _sideBar );
212 _sideBar->addWidget( _stepsPanel );
213 _sideBar->setObjectName( "steps" );
214 QY2Styler::self()->registerWidget( _sideBar );
215 _stepsPanel->setProperty( "class", "steps QFrame" );
217 // Steps panel bottom buttons ("Help", "Release Notes")
219 // Layouts for the buttons
221 _releaseNotesButton = new QPushButton( _( "Release Notes..." ), _stepsPanel );
222 _releaseNotesButton->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ) ); // hor/vert
224 connect( _releaseNotesButton, SIGNAL( clicked() ),
225 this, SLOT ( releaseNotesClicked() ) );
227 _releaseNotesButton->hide(); // hidden until showReleaseNotesButton() is called
229 _stepsDirty = true; // no layout yet
234 void YQWizard::addStep( const string & text, const string & id )
236 QString qId = fromUTF8( id );
238 if ( _stepsIDs[ qId ] )
240 y2error( "Step ID \"%s\" (\"%s\") already used for \"%s\"",
243 qPrintable( _stepsIDs[ qId ]->name() ) );
247 if ( _stepsList.last() && _stepsList.last()->name() == fromUTF8( text ) )
249 // Consecutive steps with the same name will be shown as one single step.
251 // Since steps are always added at the end of the list, it is
252 // sufficient to check the last step of the list. If the texts are the
253 // same, the other with the same text needs to get another (additional)
254 // ID to make sure setCurrentStep() works as it should.
255 _stepsList.last()->addID( qId );
259 _stepsList.append( new YQWizard::Step( fromUTF8( text ), qId ) );
263 _stepsIDs.insert( qId, _stepsList.last() );
268 void YQWizard::addStepHeading( const string & text )
270 _stepsList.append( new YQWizard::StepHeading( fromUTF8( text ) ) );
276 void YQWizard::updateSteps()
281 // Create a grid layout for the steps
282 QVBoxLayout *_stepsVBox = new QVBoxLayout( _stepsPanel );
284 QGridLayout *_stepsGrid = new QGridLayout( );
285 YUI_CHECK_NEW( _stepsGrid );
286 _stepsVBox->addLayout( _stepsGrid );
287 _stepsGrid->setColumnMinimumWidth( 0, 10 );
288 _stepsGrid->setRowStretch( 0, 1 );
289 _stepsGrid->setRowStretch( 1, 1 );
290 _stepsGrid->setRowStretch( 2, 99 );
292 const int statusCol = 1;
293 const int nameCol = 2;
298 // Create widgets for all steps and step headings in the internal list
301 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
303 YQWizard::Step * step = *i;
304 if ( step->isHeading() )
310 QLabel * label = new QLabel( step->name(), _stepsPanel );
311 YUI_CHECK_NEW( label );
312 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
313 label->setProperty( "class", "steps_heading" );
315 step->setNameLabel( label );
316 _stepsGrid->addWidget( label,
318 1, nameCol - statusCol + 1);
320 else // No heading - ordinary step
326 QLabel * statusLabel = new QLabel( _stepsPanel );
327 YUI_CHECK_NEW( statusLabel );
329 step->setStatusLabel( statusLabel );
330 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
331 _stepsGrid->addWidget( statusLabel, row, statusCol );
337 QLabel * nameLabel = new QLabel( step->name(), _stepsPanel );
338 YUI_CHECK_NEW( nameLabel );
339 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
341 step->setNameLabel( nameLabel );
342 _stepsGrid->addWidget( nameLabel, row, nameCol );
348 _stepsVBox->addStretch( 99 );
349 QVBoxLayout *rbl = new QVBoxLayout();
350 rbl->addWidget( _releaseNotesButton, 0, Qt::AlignCenter );
352 _stepsVBox->addLayout( rbl );
353 _stepsVBox->addStretch( 29 );
359 void YQWizard::updateStepStates()
364 YQWizard::Step * currentStep = findStep( _currentStepID );
365 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
369 // Set status icon and color for the current step
370 currentStep->setStatus( Step::Current );
373 // Set all steps before the current to "done"
376 while ( step != _stepsList.end() && *step != currentStep )
378 ( *step )->setStatus( Step::Done );
382 // Skip the current step - continue with the step after it
384 if ( step != _stepsList.end() )
389 // Set all steps after the current to "to do"
392 while ( step != _stepsList.end() )
394 ( *step )->setStatus( Step::Todo );
399 void YQWizard::setCurrentStep( const string & id )
401 _currentStepID = fromUTF8( id );
406 void YQWizard::deleteSteps()
408 qDeleteAll(_stepsList);
414 YQWizard::Step * YQWizard::findStep( const QString & id )
419 return _stepsIDs[ id ];
423 void YQWizard::layoutHelpPanel()
428 // Button box with bottom gradient
431 QLabel * buttonBox = new QLabel( _sideBar );
432 YUI_CHECK_NEW( buttonBox );
434 QPushButton * button;
438 // "Tree" button - intentionally without keyboard shortcut
439 button = new QPushButton( _( "Tree" ), buttonBox );
440 YUI_CHECK_NEW( button );
441 _treeButton = button;
442 button->setObjectName( "treeButton" );
447 // "Steps" button - intentionally without keyboard shortcut
448 button = new QPushButton( _( "Steps" ), buttonBox );
449 YUI_CHECK_NEW( button );
450 _stepsButton = button;
451 _stepsButton->hide();
452 _stepsButton->setObjectName( "stepsButton" );
456 // Create a dummy button just to find out how high it would become
457 button = new QPushButton( "Dummy", buttonBox );
458 YUI_CHECK_NEW( button );
461 layoutSideBarButtonBox( buttonBox, button );
465 connect( button, SIGNAL( clicked() ),
466 this, SLOT ( showTree() ) );
468 else if ( _stepsEnabled )
470 connect( button, SIGNAL( clicked() ),
471 this, SLOT ( showSteps() ) );
475 // Hide the dummy button - the button box height is fixed now.
481 void YQWizard::layoutTreePanel()
483 _treePanel = new QFrame( _sideBar );
484 YUI_CHECK_NEW( _treePanel );
485 QHBoxLayout *layout = new QHBoxLayout( _treePanel );
486 _sideBar->addWidget( _treePanel );
488 QVBoxLayout * vbox = new QVBoxLayout();
489 YUI_CHECK_NEW( vbox );
490 layout->addLayout( vbox );
494 _tree = new QY2ListView( _treePanel );
495 YUI_CHECK_NEW( _tree );
496 vbox->addWidget( _tree );
499 // _tree->addColumn( "" );
500 // _tree->header()->hide();
502 _tree->setRootIsDecorated( true );
503 _tree->setSortByInsertionSequence( true );
505 connect( _tree, SIGNAL( itemSelectionChanged ( void ) ),
506 this, SLOT ( treeSelectionChanged ( void ) ) );
508 connect( _tree, SIGNAL( spacePressed ( QTreeWidgetItem * ) ),
509 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
511 connect( _tree, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int ) ),
512 this, SLOT ( sendTreeEvent ( QTreeWidgetItem * ) ) );
517 void YQWizard::addTreeItem( const string & parentID, const string & text, const string & id )
519 QString qId = fromUTF8( id );
523 y2error( "YQWizard widget not created with `opt(`treeEnabled) !" );
527 YQWizard::TreeItem * item = 0;
528 YQWizard::TreeItem * parent = 0;
530 if ( ! parentID.empty() )
532 parent = findTreeItem( parentID );
537 item = new YQWizard::TreeItem( parent, fromUTF8( text ), qId );
538 YUI_CHECK_NEW( item );
542 item = new YQWizard::TreeItem( _tree, fromUTF8( text ), qId );
543 YUI_CHECK_NEW( item );
546 if ( ! qId.isEmpty() )
547 _treeIDs.insert( qId, item );
552 void YQWizard::deleteTreeItems()
562 YQWizard::TreeItem * YQWizard::findTreeItem( const string & id )
567 return _treeIDs[ fromUTF8( id ) ];
571 void YQWizard::selectTreeItem( const string & id )
575 YQWizard::TreeItem * item = findTreeItem( id );
579 YQSignalBlocker sigBlocker( _tree );
581 _tree->setCurrentItem(item);
582 _tree->scrollToItem(item);
588 void YQWizard::sendTreeEvent( QTreeWidgetItem * listViewItem )
592 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> ( listViewItem );
594 if ( item && ! item->id().isEmpty() )
595 sendEvent( toUTF8( item->id() ) );
600 void YQWizard::treeSelectionChanged()
601 { //FIXME is currentItem correct or selected.first
603 sendTreeEvent( _tree->currentItem() );
607 string YQWizard::currentTreeSelection()
611 QTreeWidgetItem * sel = _tree->currentItem();
615 YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> (sel);
617 if ( item && ! item->id().isEmpty() )
618 return toUTF8( item->id() );
627 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
629 QFrame *workArea = new QFrame( parent );
630 workArea->setObjectName( "work_area" );
632 QY2Styler::self()->registerWidget( workArea );
634 QVBoxLayout *vbox = new QVBoxLayout( workArea );
636 _menuBar = new QMenuBar( workArea );
637 YUI_CHECK_NEW( _menuBar );
639 _menuBar->hide(); // will be made visible when menus are added
640 vbox->addWidget( _menuBar );
643 // Dialog icon and heading
646 QHBoxLayout * headingHBox = new QHBoxLayout();
647 YUI_CHECK_NEW( headingHBox );
648 //headingHBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
649 vbox->addLayout( headingHBox );
651 _dialogIcon = new QLabel( workArea );
652 YUI_CHECK_NEW( _dialogIcon );
653 headingHBox->addWidget( _dialogIcon );
654 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); // hor/vert
655 _dialogIcon->setObjectName( "DialogIcon" );
657 _dialogHeading = new QLabel( workArea );
658 YUI_CHECK_NEW( _dialogHeading );
659 headingHBox->addWidget( _dialogHeading );
660 _dialogHeading->setAlignment( Qt::AlignLeft );
661 _dialogHeading->setWordWrap( true );
662 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
663 _dialogHeading->setObjectName( "DialogHeading" );
666 // Client area (the part that belongs to the YCP application)
669 layoutClientArea( workArea );
670 vbox->addWidget( _clientArea );
676 QLayout *bb = layoutButtonBox( workArea );
677 vbox->addLayout( bb );
684 void YQWizard::layoutClientArea( QWidget * parent )
686 _clientArea = new QFrame( parent );
687 YUI_CHECK_NEW( _clientArea );
688 QVBoxLayout *layout = new QVBoxLayout( _clientArea );
689 // _clientArea->layout()->setMargin( 4 );
692 // HVCenter for wizard contents
695 _contents = new YQAlignment( this, _clientArea, YAlignCenter, YAlignCenter );
696 YUI_CHECK_NEW( _contents );
697 layout->addWidget( _contents );
698 _contents->QObject::setProperty( "class", "Contents" );
700 _contents->setStretchable( YD_HORIZ, true );
701 _contents->setStretchable( YD_VERT, true );
702 _contents->installEventFilter( this );
703 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // hor/vert
706 // Replace point for wizard contents
709 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
712 // Initial YEmpty widget contents of replace point
715 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
716 _contentsReplacePoint->showChild();
722 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
725 // QHBoxLayout for the buttons
728 QHBoxLayout * hbox = new QHBoxLayout(); // parent, spacing
729 YUI_CHECK_NEW( hbox );
731 hbox->setSpacing( 0 );
732 hbox->setMargin( 0 );
734 // Help button - intentionally without keyboard shortcut
735 _helpButton = new QPushButton( _( "Help" ), parent );
736 YUI_CHECK_NEW( _helpButton );
738 connect( _helpButton, SIGNAL( clicked() ),
739 this, SLOT ( showHelp() ) );
741 hbox->addWidget( _helpButton );
743 hbox->addStretch( 10 );
749 _abortButton = new YQWizardButton( this, parent, _abortButtonLabel );
750 YUI_CHECK_NEW( _abortButton );
752 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
753 connect( _abortButton, SIGNAL( clicked() ),
754 this, SLOT ( slotAbortClicked() ) );
756 hbox->addSpacing( 10 );
762 _backButton = new YQWizardButton( this, parent, _backButtonLabel );
763 YUI_CHECK_NEW( _backButton );
765 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
766 connect( _backButton, SIGNAL( clicked() ),
767 this, SLOT ( slotBackClicked() ) );
769 if ( _backButton->text().isEmpty() )
776 hbox->addSpacing( 5 );
778 _nextButton = new YQWizardButton( this, parent, _nextButtonLabel );
779 YUI_CHECK_NEW( _nextButton );
781 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
782 connect( _nextButton, SIGNAL( clicked() ),
783 this, SLOT ( slotNextClicked() ) );
788 void YQWizard::destroyButtons()
801 void YQWizard::connectNotify ( const char * signal )
803 if ( QString( signal ).contains( "nextClicked()" ) )
805 y2debug( "nextClicked connected, no longer directly sending button events" );
806 _sendButtonEvents = false;
811 void YQWizard::disconnectNotify ( const char * signal )
813 if ( QString( signal ).contains( "nextClicked()" ) )
815 y2debug( "nextClicked disconnected, directly sending button events again" );
816 _sendButtonEvents = true;
821 void YQWizard::setDialogIcon( const string & iconName )
825 if ( ! iconName.empty() )
827 QPixmap icon( iconName.c_str() );
830 y2warning( "Couldn't load dialog icon \"%s\"", iconName.c_str() );
833 _dialogIcon->setPixmap( icon );
834 topLevelWidget()->setWindowIcon( icon );
839 _dialogIcon->clear();
840 topLevelWidget()->setWindowIcon( QIcon() );
846 void YQWizard::setDialogHeading( const string & headingText )
848 if ( _dialogHeading )
850 if ( ! headingText.empty() )
851 _dialogHeading->setText( fromUTF8( headingText ) );
853 _dialogHeading->clear();
857 string YQWizard::debugLabel()
859 if ( _dialogHeading )
861 QString label = _dialogHeading->text();
862 label = label.simplified(); // Replace any embedded newline with a single blank
864 if ( ! label.isEmpty() )
866 label.prepend( "YQWizard \"" );
867 label.append( "\"" );
869 return toUTF8( label );
873 return "untitled YQWizard";
876 void YQWizard::setHelpText( const string & helpText )
878 _qHelpText = fromUTF8( helpText );
879 _qHelpText.replace( "&product;", YQUI::ui()->productName() );
883 void YQWizard::slotBackClicked()
887 if ( _sendButtonEvents )
888 YQUI::ui()->sendEvent( new YWidgetEvent( _backButton, YEvent::Activated ) );
890 _direction = YQWizard::Backward;
894 void YQWizard::slotAbortClicked()
898 if ( _sendButtonEvents )
899 YQUI::ui()->sendEvent( new YWidgetEvent( _abortButton, YEvent::Activated ) );
903 void YQWizard::slotNextClicked()
907 if ( _sendButtonEvents )
908 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
910 _direction = YQWizard::Forward;
914 void YQWizard::showHelp()
916 QDialog helpDlg( this );
918 ui.setupUi( &helpDlg );
919 ui.textBrowser->setText( _qHelpText );
924 void YQWizard::releaseNotesClicked()
926 YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
928 if ( ! _releaseNotesButtonId.empty() )
930 y2milestone( "Release Notes button clicked" );
931 sendEvent( _releaseNotesButtonId );
936 void YQWizard::showSteps()
938 if ( _sideBar && _stepsPanel )
940 _sideBar->setCurrentWidget( _stepsPanel );
945 void YQWizard::showTree()
947 if ( _sideBar && _treePanel )
949 _sideBar->setCurrentWidget( _treePanel );
955 void YQWizard::addMenu( const string & text,
960 QMenu * menu = new QMenu( _menuBar );
961 YUI_CHECK_NEW( menu );
963 _menuIDs.insert( fromUTF8( id ), menu );
964 //FIXME _menuBar->insertItem( fromUTF8( text ), menu );
966 connect( menu, SIGNAL( activated ( int ) ),
967 this, SLOT ( sendMenuEvent( int ) ) );
974 void YQWizard::addSubMenu( const string & parentMenuID,
978 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
982 QMenu * menu = new QMenu( _menuBar );
983 YUI_CHECK_NEW( menu );
985 _menuIDs.insert( fromUTF8( id ), menu );
986 //FIXME parentMenu->insertItem( fromUTF8( text ), menu );
988 connect( menu, SIGNAL( activated ( int ) ),
989 this, SLOT ( sendMenuEvent( int ) ) );
993 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
998 void YQWizard::addMenuEntry( const string & parentMenuID,
1000 const string & idString )
1002 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1006 int id = _menuEntryIDs.size();
1007 _menuEntryIDs.push_back( idString );
1008 //FIXME parentMenu->insertItem( fromUTF8( text ), id );
1012 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1017 void YQWizard::addMenuSeparator( const string & parentMenuID )
1019 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1023 parentMenu->addSeparator();
1027 y2error( "Can't find menu with ID %s", parentMenuID.c_str() );
1032 void YQWizard::deleteMenus()
1039 _menuEntryIDs.clear();
1044 void YQWizard::sendMenuEvent( int numID )
1046 if ( numID >= 0 && numID < (int) _menuEntryIDs.size() )
1048 sendEvent( _menuEntryIDs[ numID ] );
1052 y2error( "Invalid menu ID: %d", numID );
1057 void YQWizard::sendEvent( const string & id )
1059 YQUI::ui()->sendEvent( new YMenuEvent( id ) );
1063 int YQWizard::preferredWidth()
1065 return sizeHint().width();
1069 int YQWizard::preferredHeight()
1071 return sizeHint().height();
1075 void YQWizard::setSize( int newWidth, int newHeight )
1077 resize( newWidth, newHeight );
1083 void YQWizard::resizeClientArea()
1085 y2debug( "resizing client area" );
1086 QRect contentsRect = _clientArea->contentsRect();
1087 _contents->setSize( contentsRect.width(), contentsRect.height() );
1090 bool YQWizard::eventFilter( QObject * obj, QEvent * ev )
1092 if ( ev->type() == QEvent::Resize && obj == _contents )
1095 return true; // Event handled
1098 return QWidget::eventFilter( obj, ev );
1102 void YQWizard::setButtonLabel( YPushButton * button, const string & newLabel )
1104 button->setLabel( newLabel );
1105 YDialog::currentDialog()->checkShortcuts();
1107 YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (button);
1110 wizardButton->setVisible( !newLabel.empty() );
1114 void YQWizard::showReleaseNotesButton( const string & label, const string & id )
1116 return; // no longer supported!
1118 if ( ! _releaseNotesButton )
1120 y2error( "NULL Release Notes button" );
1122 if ( ! _stepsPanel )
1123 y2error( "This works only if there is a \"steps\" panel!" );
1128 // no way to check the shortcut, so strip it
1129 _releaseNotesButton->setText( fromUTF8( YShortcut::cleanShortcutString( label ) ) );
1130 _releaseNotesButtonId = id;
1132 _releaseNotesButton->show();
1136 void YQWizard::hideReleaseNotesButton()
1138 if ( _releaseNotesButton && !_releaseNotesButton->isHidden() )
1139 _releaseNotesButton->hide();
1143 void YQWizard::retranslateInternalButtons()
1145 YQUI::setTextdomain( TEXTDOMAIN );
1148 // "Help" button - intentionally without keyboard shortcut
1149 _helpButton->setText( _( "Help" ) );
1152 // "Steps" button - intentionally without keyboard shortcut
1153 _stepsButton->setText( _( "Steps" ) );
1156 // "Tree" button - intentionally without keyboard shortcut
1157 _treeButton->setText( _( "Tree" ) );
1160 void YQWizard::Step::setStatus( Status s )
1162 if ( !_statusLabel || !_nameLabel || _status == s )
1169 _statusLabel->setProperty( "class", "todo-step-status QLabel" );
1170 _nameLabel->setProperty( "class", "todo-step-name QLabel" );
1175 _statusLabel->setProperty( "class", "done-step-status QLabel" );
1176 _nameLabel->setProperty( "class", "done-step-name QLabel" );
1181 _statusLabel->setProperty( "class", "current-step-status QLabel" );
1182 _nameLabel->setProperty( "class", "current-step-name QLabel" );
1185 qApp->style()->polish( _statusLabel );
1186 qApp->style()->polish( _nameLabel );
1189 #include "YQWizard.moc"