28 #define YUILogComponent "qt-wizard"
29 #include <yui/YUILog.h>
32 #include <yui/YShortcut.h>
35 #include <QSvgRenderer>
37 #include <QStackedWidget>
44 #include <qpushbutton.h>
46 #include <qtabwidget.h>
47 #include <qtoolbutton.h>
48 #include <QGraphicsDropShadowEffect>
50 #include "QY2ListView.h"
51 #include "QY2Styler.h"
52 #include "QY2HelpDialog.h"
53 #include "QY2RelNotesDialog.h"
54 #include <QGridLayout>
55 #include <QHeaderView>
61 #include "YQApplication.h"
63 #include "YQAlignment.h"
64 #include "YQReplacePoint.h"
67 #include "YQWizardButton.h"
68 #include "YQWidgetFactory.h"
69 #include "YQSignalBlocker.h"
70 #include <yui/YEvent.h>
71 #include "YQMainWinDock.h"
80 #define TEXTDOMAIN "qt"
82 #define USE_ICON_ON_HELP_BUTTON 0
85 std::string YQWizard::_releaseNotesButtonId =
"";
86 std::string YQWizard::_releaseNotesButtonLabel =
"";
89 const std::string & backButtonLabel,
90 const std::string & abortButtonLabel,
91 const std::string & nextButtonLabel,
92 YWizardMode wizardMode )
93 : QSplitter( Qt::Horizontal, (QWidget *) parent->widgetRep() )
100 , _backButtonLabel( backButtonLabel )
101 , _abortButtonLabel( abortButtonLabel )
102 , _nextButtonLabel( nextButtonLabel )
104 , _relNotesDlg ( NULL )
106 setObjectName(
"wizard" );
107 setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
109 QHBoxLayout* layout =
new QHBoxLayout(
this );
110 layout->setSpacing( 0 );
111 layout->setMargin( 0 );
113 setWidgetRep(
this );
116 _stepsEnabled = ( (wizardMode == YWizardMode_Steps) || main_wizard );
117 _treeEnabled = (wizardMode == YWizardMode_Tree);
119 _stepsRegistered =
false;
121 _direction = YQWizard::Forward;
128 _releaseNotesButton = 0;
141 _sendButtonEvents =
true;
142 _contentsReplacePoint = 0;
144 _previousWindowIcon = topLevelWidget()->windowIcon();
150 if( topLevelWidget()->windowTitle().isEmpty() )
153 QPixmap pixmap ( YUI::app()->applicationIcon().c_str() );
154 if ( !pixmap.isNull() )
155 setWindowIcon ( QIcon ( pixmap ) );
158 layout->addLayout( layoutSideBar(
this ) );
159 layout->addWidget( layoutWorkArea(
this ) );
161 setStretchFactor(indexOf(_sideBar),0);
162 setStretchFactor(indexOf(_workArea),1);
166 if ( !_stepsEnabled )
167 QY2Styler::styler()->registerWidget(
this );
169 if ( !main_wizard && _stepsEnabled )
173 else if ( main_wizard )
180 topLevelWidget()->activateWindow();
188 if (
this == main_wizard )
192 else if ( main_wizard )
195 main_wizard->setSizes( sizes() );
201 QY2Styler::styler()->unregisterWidget(
this );
202 topLevelWidget()->setWindowIcon( _previousWindowIcon );
208 return this != main_wizard;
212 void YQWizard::layoutTitleBar( QWidget * parent )
214 QFrame * titleBar =
new QFrame( parent );
215 YUI_CHECK_NEW( titleBar );
217 QHBoxLayout *layout =
new QHBoxLayout( titleBar );
218 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
224 QLabel * left =
new QLabel( titleBar );
225 layout->addWidget( left );
226 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
227 left->setObjectName(
"titleBar-left" );
233 layout->addStretch( 10 );
240 QLabel * right =
new QLabel( titleBar );
241 YUI_CHECK_NEW( right );
243 layout->addWidget( right );
244 right->setObjectName(
"titleBar-right" );
248 QLayout *YQWizard::layoutSideBar( QWidget * parent )
250 _sideBar =
new QStackedWidget( parent );
251 YUI_CHECK_NEW( _sideBar );
253 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
254 _sideBar->setObjectName( QString(
"_sideBar-%1" ).arg(
long(
this ) ) );
255 _sideBar->installEventFilter(
this );
257 QVBoxLayout *vbox =
new QVBoxLayout( );
258 vbox->addWidget( _sideBar );
265 else if ( _stepsEnabled )
277 void YQWizard::layoutStepsPanel()
280 _stepsPanel =
new QFrame( _sideBar );
281 _sideBar->addWidget( _stepsPanel );
282 _stepsPanel->setObjectName(
"steps" );
283 QY2Styler::styler()->registerChildWidget(
this, _stepsPanel );
284 _stepsPanel->setProperty(
"class",
"steps QFrame" );
292 QString qId = fromUTF8(
id );
294 if ( _stepsIDs[ qId ] )
296 yuiError() <<
"Step ID \"" <<
id <<
"\" (\"" << text
297 <<
"\") already used for \"" << _stepsIDs[ qId ]->name() <<
"\""
302 if ( !_stepsList.empty() && _stepsList.last()->name() == fromUTF8( text ) )
310 _stepsList.last()->addID( qId );
318 _stepsIDs.insert( qId, _stepsList.last() );
321 if ( _currentStepID.isNull() )
322 _currentStepID = qId;
338 yuiDebug() <<
"updateSteps" << std::endl;
340 if ( !_stepsRegistered )
341 setUpdatesEnabled(
false);
344 delete _stepsPanel->layout();
345 _stepsPanel->setMaximumWidth( 65000 );
347 QVBoxLayout *_stepsVBox =
new QVBoxLayout( _stepsPanel );
349 QGridLayout *_stepsGrid =
new QGridLayout( );
350 _stepsGrid->setObjectName( QString(
"_stepsGrid_%1" ).arg(
long(
this ) ) );
351 YUI_CHECK_NEW( _stepsGrid );
352 _stepsVBox->addLayout( _stepsGrid );
353 _stepsGrid->setColumnMinimumWidth( 0, 10 );
354 _stepsGrid->setRowStretch( 0, 1 );
355 _stepsGrid->setRowStretch( 1, 1 );
356 _stepsGrid->setRowStretch( 2, 99 );
358 const int statusCol = 1;
359 const int nameCol = 2;
367 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
371 step->deleteLabels();
373 if ( step->isHeading() )
379 yuiDebug() <<
"Adding StepHeading \"" << step->name() <<
"\"" << std::endl;
380 QLabel * label =
new QLabel( step->name(), _stepsPanel );
381 YUI_CHECK_NEW( label );
382 label->setObjectName( step->name() );
383 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
384 label->setProperty(
"class",
"steps_heading" );
386 step->setNameLabel( label );
387 _stepsGrid->addWidget( label,
389 1, nameCol - statusCol + 1);
397 yuiDebug() <<
"Adding Step \"" << step->name() <<
"\"" << std::endl;
399 QLabel * statusLabel =
new QLabel( _stepsPanel );
400 YUI_CHECK_NEW( statusLabel );
402 step->setStatusLabel( statusLabel );
403 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
404 _stepsGrid->addWidget( statusLabel, row, statusCol );
410 QLabel * nameLabel =
new QLabel( step->name(), _stepsPanel );
411 YUI_CHECK_NEW( nameLabel );
412 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
413 nameLabel->setObjectName( step->name() );
415 step->setNameLabel( nameLabel );
416 _stepsGrid->addWidget( nameLabel, row, nameCol );
423 _stepsVBox->addStretch( 99 );
424 QVBoxLayout *rbl =
new QVBoxLayout();
425 rbl->addWidget( (QWidget *) _releaseNotesButton->widgetRep(), 0, Qt::AlignCenter );
427 _stepsVBox->addLayout( rbl );
428 _stepsVBox->addStretch( 29 );
432 if ( !_stepsRegistered )
434 QY2Styler::styler()->registerWidget(
this );
435 setUpdatesEnabled(
true );
436 QY2Styler::styler()->updateRendering(
this );
437 _stepsRegistered =
true;
444 yuiDebug() <<
"steps dirty: " << _stepsDirty << std::endl;
450 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
461 while ( step != _stepsList.end() && *step !=
currentStep )
463 ( *step )->setStatus( Step::Done );
469 if ( step != _stepsList.end() )
477 while ( step != _stepsList.end() )
479 ( *step )->setStatus( Step::Todo );
487 yuiDebug() <<
"Setting current step to \"" <<
id <<
"\"" << std::endl;
489 _currentStepID = fromUTF8(
id );
495 QList<Step*> _oldSteps = wizard->
stepsList();
497 if (_oldSteps.empty())
500 foreach(
Step *oldStep, _oldSteps)
504 if( !oldStep->isHeading() )
505 newStep =
new Step( oldStep->name());
509 foreach( QString oneId, oldStep->id())
511 newStep->addID( oneId);
512 _stepsIDs.insert( oneId, newStep );
515 newStep->setEnabled( oldStep->isEnabled());
516 _stepsList.append(newStep);
521 setSizes( main_wizard->sizes());
527 yuiDebug() <<
"Deleting steps" << std::endl;
530 _stepsPanel->setFixedWidth( _stepsPanel->width() );
532 qDeleteAll(_stepsList);
535 _currentStepID = QString::null;
545 return _stepsIDs[ id ];
549 void YQWizard::layoutTreePanel()
551 _treePanel =
new QFrame( _sideBar );
552 YUI_CHECK_NEW( _treePanel );
553 QHBoxLayout *layout =
new QHBoxLayout( _treePanel );
554 _sideBar->addWidget( _treePanel );
556 QVBoxLayout * vbox =
new QVBoxLayout();
557 YUI_CHECK_NEW( vbox );
558 layout->addLayout( vbox );
563 YUI_CHECK_NEW( _tree );
564 vbox->addWidget( _tree );
566 _tree->header()->hide();
567 _tree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
569 _tree->setRootIsDecorated(
true );
572 connect( _tree, &pclass(_tree)::itemSelectionChanged,
575 connect( _tree, &pclass(_tree)::itemDoubleClicked,
583 QString qId = fromUTF8(
id );
587 yuiError() <<
"YQWizard widget not created with `opt(`treeEnabled) !" << std::endl;
594 if ( ! parentID.empty() )
602 YUI_CHECK_NEW( item );
607 YUI_CHECK_NEW( item );
610 if ( ! qId.isEmpty() )
611 _treeIDs.insert( qId, item );
631 return _treeIDs[ fromUTF8(
id ) ];
645 _tree->setCurrentItem(item);
646 _tree->scrollToItem(item);
658 if ( item && ! item->id().isEmpty() )
675 QTreeWidgetItem * sel = _tree->currentItem();
681 if ( item && ! item->id().isEmpty() )
682 return toUTF8( item->id() );
686 return std::string();
691 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
693 _workArea =
new QFrame( parent );
695 QVBoxLayout *vbox =
new QVBoxLayout( _workArea );
696 YUI_CHECK_NEW( vbox );
699 if (YUI::application()->showProductLogo())
701 QWidget * logoWidget =
new QWidget;
702 logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
703 logoWidget->setObjectName(
"LogoHBox");
704 vbox->addWidget( logoWidget );
706 QHBoxLayout * logoHBox =
new QHBoxLayout(logoWidget);
707 YUI_CHECK_NEW( logoHBox );
709 _dialogLogo =
new QLabel( _workArea );
710 YUI_CHECK_NEW( _dialogLogo );
711 logoHBox->addWidget( _dialogLogo );
712 _dialogLogo->setObjectName(
"DialogLogo" );
713 _dialogLogo->setAlignment( Qt::AlignLeft );
714 QY2Styler::styler()->registerChildWidget(
this, _dialogLogo );
715 _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
716 _dialogLogo->setMinimumHeight(59);
717 _dialogLogo->setMinimumWidth(100);
718 logoHBox->addStretch();
725 _menuBar =
new QMenuBar( _workArea );
726 YUI_CHECK_NEW( _menuBar );
729 vbox->addWidget( _menuBar );
731 QWidget * dialog_inner_area =
new QWidget (_workArea);
732 dialog_inner_area->setObjectName(
"work_area" );
734 QY2Styler::styler()->registerChildWidget(
this, dialog_inner_area );
735 QVBoxLayout * inner_vbox =
new QVBoxLayout(dialog_inner_area);
736 YUI_CHECK_NEW( inner_vbox );
737 vbox->addWidget (dialog_inner_area);
739 QVBoxLayout *innerbox =
new QVBoxLayout( _workArea );
740 QVBoxLayout *leftInnerBox = innerbox;
741 QVBoxLayout *rightInnerBox = innerbox;
742 YUI_CHECK_NEW( innerbox );
744 innerbox->setMargin ( YQWidgetMargin );
746 inner_vbox->addLayout(innerbox);
747 vbox->setMargin( 0 );
754 if (titleIsOnTheLeft()) {
755 QHBoxLayout *bigHBox =
new QHBoxLayout();
756 innerbox->addLayout( bigHBox );
758 leftInnerBox =
new QVBoxLayout();
759 leftInnerBox->setObjectName(
"LeftInnerBox" );
760 bigHBox->addLayout( leftInnerBox );
761 bigHBox->setStretchFactor( leftInnerBox, 1 );
763 rightInnerBox =
new QVBoxLayout();
764 rightInnerBox->setObjectName(
"RightInnerBox" );
765 bigHBox->addLayout( rightInnerBox );
766 bigHBox->setStretchFactor( rightInnerBox, 2 );
769 QHBoxLayout * headingHBox =
new QHBoxLayout();
770 YUI_CHECK_NEW( headingHBox );
772 leftInnerBox->addLayout( headingHBox );
774 _dialogIcon =
new QLabel( _workArea );
775 YUI_CHECK_NEW( _dialogIcon );
776 headingHBox->addWidget( _dialogIcon );
777 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
778 _dialogIcon->setObjectName(
"DialogIcon" );
780 _dialogHeading =
new QLabel( _workArea );
781 YUI_CHECK_NEW( _dialogHeading );
782 headingHBox->addWidget( _dialogHeading );
783 _dialogHeading->setWordWrap(
true );
784 _dialogHeading->setTextFormat( Qt::PlainText );
785 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
786 _dialogHeading->setObjectName( (titleIsOnTheLeft())?
"DialogHeadingLeft" :
"DialogHeadingTop" ) ;
792 layoutClientArea( _workArea );
793 rightInnerBox->addWidget( _clientArea );
799 QLayout *bb = layoutButtonBox( _workArea );
800 innerbox->addLayout( bb );
807 void YQWizard::layoutClientArea( QWidget * parent )
809 _clientArea =
new QFrame( parent );
810 YUI_CHECK_NEW( _clientArea );
811 _clientArea->setObjectName(
"_clientArea");
812 QVBoxLayout *layout =
new QVBoxLayout( _clientArea );
813 layout->setMargin( 0 );
819 _contents =
new YQAlignment(
this, _clientArea, YAlignCenter, YAlignCenter );
820 YUI_CHECK_NEW( _contents );
821 layout->addWidget( _contents );
822 _contents->QObject::setProperty(
"class",
"Contents" );
824 _contents->setStretchable( YD_HORIZ,
true );
825 _contents->setStretchable( YD_VERT,
true );
826 _contents->installEventFilter(
this );
827 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
833 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
839 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
840 _contentsReplacePoint->showChild();
846 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
852 QHBoxLayout * hbox =
new QHBoxLayout();
853 YUI_CHECK_NEW( hbox );
855 hbox->setSpacing( 0 );
856 hbox->setMargin( 0 );
860 _helpButton =
new YQWizardButton(
this, parent, _(
"&Help" ).toStdString());
861 YUI_CHECK_NEW( _helpButton );
863 connect( _helpButton, &pclass(_helpButton)::clicked,
866 hbox->addWidget( (QWidget *) _helpButton->widgetRep() );
869 _helpAction =
new QAction(
this );
870 _helpAction->setShortcut( Qt::Key_F1 );
871 addAction( _helpAction );
873 connect( _helpAction, &pclass( _helpAction )::triggered,
877 hbox->addSpacing( 10 );
885 _releaseNotesButton =
new YQWizardButton(
this, parent, _(
"&Release Notes" ).toStdString ());
886 YUI_CHECK_NEW( _releaseNotesButton );
887 hbox->addWidget( (QWidget *) _releaseNotesButton->widgetRep() );
888 connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked,
892 if (_releaseNotesButtonId ==
"")
894 _releaseNotesButton->
hide();
901 hbox->addStretch( 10 );
907 _abortButton =
new YQWizardButton(
this, parent, _abortButtonLabel );
908 YUI_CHECK_NEW( _abortButton );
910 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
911 connect( _abortButton, &pclass(_abortButton)::clicked,
914 hbox->addSpacing( 10 );
920 _backButton =
new YQWizardButton(
this, parent, _backButtonLabel );
921 YUI_CHECK_NEW( _backButton );
923 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
924 connect( _backButton, &pclass(_backButton)::clicked,
927 if ( _backButton->
text().isEmpty() )
934 hbox->addSpacing( 5 );
936 _nextButton =
new YQWizardButton(
this, parent, _nextButtonLabel );
937 YUI_CHECK_NEW( _nextButton );
939 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
940 connect( _nextButton, &pclass(_nextButton)::clicked,
946 bool YQWizard::titleIsOnTheLeft()
948 return wizardMode() == YWizardMode_TitleOnLeft;
966 if ( QString( signal ).contains(
"nextClicked()" ) )
968 yuiDebug() <<
"nextClicked connected, no longer directly sending button events" << std::endl;
969 _sendButtonEvents =
false;
976 if ( QString( signal ).contains(
"nextClicked()" ) )
978 yuiDebug() <<
"nextClicked disconnected, directly sending button events again" << std::endl;
979 _sendButtonEvents =
true;
988 if ( ! iconName.empty() )
990 QPixmap icon( iconName.c_str() );
993 yuiWarning() <<
"Couldn't load dialog icon \"" << iconName <<
"\"" << std::endl;
996 _dialogIcon->setPixmap( icon );
997 topLevelWidget()->setWindowIcon( icon );
1002 _dialogIcon->clear();
1003 topLevelWidget()->setWindowIcon( QIcon() );
1011 QString title = fromUTF8( titleText.c_str() );
1013 if ( !title.isEmpty() )
1022 if ( _dialogHeading )
1024 if ( ! headingText.empty() )
1025 _dialogHeading->setText( fromUTF8( headingText ) );
1027 _dialogHeading->clear();
1033 if ( _dialogHeading )
1035 QString label = _dialogHeading->text();
1036 label = label.simplified();
1038 if ( ! label.isEmpty() )
1039 return toUTF8( label );
1042 return "untitled YQWizard";
1048 _qHelpText = fromUTF8( helpText );
1049 _qHelpText.replace(
"&product;", fromUTF8( YUI::app()->productName() ) );
1057 if ( _sendButtonEvents )
1060 _direction = YQWizard::Backward;
1068 if ( _sendButtonEvents )
1077 if ( _sendButtonEvents )
1080 _direction = YQWizard::Forward;
1090 _helpDlg->setHelpText( _qHelpText );
1096 _helpDlg->activateWindow();
1106 _relNotesDlg->hide();
1109 std::map<std::string,std::string> relnotes = YUI::application()->releaseNotes();
1110 if ( relnotes.size() == 0)
1114 _relNotesDlg->setRelNotes( relnotes );
1115 _relNotesDlg->show();
1116 _relNotesDlg->raise();
1117 _relNotesDlg->activateWindow();
1123 if ( _sideBar && _stepsPanel )
1125 _sideBar->setCurrentWidget( _stepsPanel );
1132 if ( _sideBar && _treePanel )
1134 _sideBar->setCurrentWidget( _treePanel );
1140 const std::string &
id )
1144 QMenu * menu =
new QMenu( _menuBar );
1145 YUI_CHECK_NEW( menu );
1147 _menuIDs.insert( fromUTF8(
id ), menu );
1148 _menuBar->addMenu( menu );
1149 menu->setTitle( fromUTF8( text ) );
1151 connect( menu, &pclass(menu)::triggered,
1160 const std::string & text,
1161 const std::string &
id )
1163 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1167 QMenu * menu =
new QMenu( _menuBar );
1168 YUI_CHECK_NEW( menu );
1170 _menuIDs.insert( fromUTF8(
id ), menu );
1173 connect( menu, &pclass(menu)::triggered,
1178 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1184 const std::string & text,
1185 const std::string & idString )
1187 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1192 int id = _menuEntryIDs.size();
1195 action = parentMenu->addAction( fromUTF8( text ) );
1196 _menuEntryIDs[ action ] = idString ;
1201 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1208 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1212 parentMenu->addSeparator();
1216 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1228 _menuEntryIDs.clear();
1235 if ( _menuEntryIDs.contains( action ) )
1241 yuiError() <<
"Invalid menu ID " << std::endl;
1254 return sizeHint().width();
1260 return sizeHint().height();
1266 resize( newWidth, newHeight );
1272 QSize contentsRect = _clientArea->contentsRect().size();
1273 _contents->
setSize( contentsRect.width(), contentsRect.height() );
1278 if ( ev->type() == QEvent::Resize && obj == _contents )
1284 if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
1290 return QWidget::eventFilter( obj, ev );
1296 button->setLabel( newLabel );
1297 YDialog::currentDialog()->checkShortcuts();
1301 if ( wizardButton ) {
1303 if ( newLabel.empty() )
1304 wizardButton->
hide();
1306 wizardButton->
show();
1313 if ( ! _releaseNotesButton )
1315 yuiError() <<
"NULL Release Notes button" << std::endl;
1317 if ( ! _stepsPanel )
1318 yuiError() <<
"This works only if there is a \"steps\" panel!" << std::endl;
1324 _releaseNotesButton->
setLabel( fromUTF8( label ) );
1325 _releaseNotesButtonId = id;
1326 _releaseNotesButtonLabel = label;
1328 _releaseNotesButton->
show();
1334 if ( _releaseNotesButton && !_releaseNotesButton->
isHidden() )
1336 _releaseNotesButton->
hide();
1337 _releaseNotesButtonId =
"";
1338 _releaseNotesButtonLabel =
"";
1350 _helpButton->
setLabel( _(
"&Help" ) );
1355 _stepsButton->setText( _(
"&Steps" ) );
1360 _treeButton->setText( _(
"&Tree" ) );
1362 if ( _releaseNotesButton )
1365 _releaseNotesButton->
setLabel( _(
"&Release Notes" ) );
1368 _helpDlg->retranslate();
1371 _relNotesDlg->retranslate();
1376 void YQWizard::Step::deleteLabels()
1378 delete _statusLabel;
1393 if ( !_statusLabel || !_nameLabel || _status == s )
1400 _statusLabel->setProperty(
"class",
"todo-step-status QLabel" );
1401 _nameLabel->setProperty (
"class",
"todo-step-name QLabel" );
1406 _statusLabel->setProperty(
"class",
"done-step-status QLabel" );
1407 _nameLabel->setProperty (
"class",
"done-step-name QLabel" );
1412 _statusLabel->setProperty(
"class",
"current-step-status QLabel" );
1413 _nameLabel->setProperty (
"class",
"current-step-name QLabel" );
1416 _statusLabel->style()->unpolish( _statusLabel );
1417 _statusLabel->style()->polish( _statusLabel );
1418 _nameLabel->style()->unpolish( _nameLabel );
1419 _nameLabel->style()->polish( _nameLabel );
1422 #include "YQWizard.moc"
virtual std::string currentTreeSelection()
Returns the current tree selection or an empty std::string if nothing is selected or there is no tree...
Helper class to block Qt signals for QWidgets or QObjects as long as this object exists.
void showReleaseNotes()
Propagate button clicked event of release notes button to the application.
bool fullscreen() const
Return 'true' if defaultsize windows should use the full screen.
bool isSecondary() const
Returns true if the wizard should follow the first wizard with steps.
virtual void setSortByInsertionSequence(bool sortByInsertionSequence)
Enforce sorting by item insertion order (true) or let user change sorting by clicking on a column hea...
virtual void setCurrentStep(const std::string &id)
Set the current step.
void resizeClientArea()
Adapt the size of the client area (the ReplacePoint(id(contents)) to fit in its current space...
virtual ~Step()
Destructor.
virtual void setDialogIcon(const std::string &iconName)
Set the dialog icon.
void setSideBarWidth(int width)
For secondary wizards.
void destroyButtons()
Destroy the button box's buttons.
virtual void deleteTreeItems()
Delete all tree items.
void sendTreeEvent(QTreeWidgetItem *item)
Internal notification that [Space] or [Return] has been pressed on a tree item.
void showSteps()
Show the current wizard steps, if there are any.
virtual std::string debugLabel() const
Returns a descriptive label of this dialog instance for debugging.
Helper class to represent a wizard step heading internally.
virtual void setHelpText(const std::string &helpText)
Set the help text.
virtual void setButtonLabel(YPushButton *button, const std::string &newLabel)
Set the label of one of the wizard buttons (backButton(), abortButton(), nextButton() ) if that butto...
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
void connectNotify(const char *signal)
Notification that a signal is being connected.
virtual void clear()
Reimplemented from Q3ListView: Adjust header sizes after clearing contents.
virtual void deleteSteps()
Delete all steps and step headings from the internal lists.
QString applicationTitle()
Returns the application name for the window title (e.g.
Helper class for wizard tree item.
virtual void showReleaseNotesButton(const std::string &label, const std::string &id)
Show a "Release Notes" button above the "Help" button in the steps panel with the specified label tha...
virtual bool eventFilter(QObject *obj, QEvent *ev)
Event filter.
void slotAbortClicked()
Internal notification that the "Abort" button has been clicked.
virtual void selectTreeItem(const std::string &id)
Select the tree item with the specified ID, if such an item exists.
YQWizard(YWidget *parent, const std::string &backButtonLabel, const std::string &abortButtonLabel, const std::string &nextButtonLabel, YWizardMode wizardMode=YWizardMode_Standard)
Constructor.
void copySteps(YQWizard *wizard)
Create a copy of given wizard's steps set (names & IDs) Populates _stepsList structure of current wiz...
virtual void addStepHeading(const std::string &text)
Add a step heading for the steps panel on the side bar.
void treeSelectionChanged()
Internal notification that the tree selection has changed.
virtual void setDialogHeading(const std::string &headingText)
Set the dialog heading.
void resizeVisibleChild()
Resize the visible child to the current size of the dock.
virtual void setDialogTitle(const std::string &titleText)
Set the dialog title shown in window manager's title bar.
virtual ~YQWizard()
Destructor.
virtual void addMenuEntry(const std::string &parentMenuID, const std::string &text, const std::string &id)
Add a menu entry to the menu with ID 'parentMenuID'.
static YQMainWinDock * mainWinDock()
Static method to access the singleton for this class.
YQWizard::TreeItem * findTreeItem(const std::string &id)
Find a tree item with the specified ID.
void abortClicked()
Emitted when the "Abort" button is clicked.
void setStatus(Status s)
Set text color and status icon for one wizard step.
virtual void hideReleaseNotesButton()
Hide an existing "Release Notes" button.
void sendEvent(YEvent *event)
Widget event handlers (slots) call this when an event occured that should be the answer to a UserInpu...
void slotBackClicked()
Internal notification that the "Back" button has been clicked.
virtual void retranslateInternalButtons()
Retranslate internal buttons that are not accessible from the outside:
virtual void addMenuSeparator(const std::string &parentMenuID)
Add a menu separator to a menu.
QString currentStep()
Return QString ID of currently active step.
virtual void addStep(const std::string &text, const std::string &id)
Add a step for the steps panel on the side bar.
virtual void deleteMenus()
Delete all menus and hide the menu bar.
void showHelp()
Show the current help text.
virtual void addSubMenu(const std::string &parentMenuID, const std::string &text, const std::string &id)
Add a submenu to the menu with ID 'parentMenuID'.
void slotNextClicked()
Internal notification that the "Next" button has been clicked.
YQWizard::Step * findStep(const QString &id)
Find a step with the specified ID.
virtual int preferredHeight()
Preferred height of the widget.
void showTree()
Show the current selection tree in the side panel, if there is any.
void sendEvent(const std::string &id)
Send a wizard event with the specified ID.
Helper class to represent a wizard step internally.
virtual void addMenu(const std::string &text, const std::string &id)
Add a menu to the menu bar.
QList< YQWizard::Step * > stepsList()
Return list of pointers to steps.
virtual void addTreeItem(const std::string &parentID, const std::string &text, const std::string &id)
Add a tree item.
void nextClicked()
Emitted when the "Next" or "OK" button is clicked.
void disconnectNotify(const char *signal)
Notification that a signal is being disconnected.
void updateStepStates()
Update all step - use appropriate icons and colors.
void sendMenuEvent(QAction *action)
Internal notification that a menu item with numeric ID 'numID' has been activated.
virtual int preferredWidth()
Preferred width of the widget.
static void setTextdomain(const char *domain)
Initialize and set a textdomain for gettext()
void backClicked()
Emitted when the "Back" or "Cancel" button is clicked.
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
static YQUI * ui()
Access the global Qt-UI.
virtual void updateSteps()
Update the steps display: Reflect the internal steps and heading lists in the layout.