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 <QGridLayout>
54 #include <QHeaderView>
60 #include "YQApplication.h"
62 #include "YQAlignment.h"
63 #include "YQReplacePoint.h"
66 #include "YQWizardButton.h"
67 #include "YQWidgetFactory.h"
68 #include "YQSignalBlocker.h"
69 #include <yui/YEvent.h>
70 #include "YQMainWinDock.h"
79 #define TEXTDOMAIN "qt"
81 #define USE_ICON_ON_HELP_BUTTON 0
84 std::string YQWizard::_releaseNotesButtonId =
"";
85 std::string YQWizard::_releaseNotesButtonLabel =
"";
88 const std::string & backButtonLabel,
89 const std::string & abortButtonLabel,
90 const std::string & nextButtonLabel,
91 YWizardMode wizardMode )
92 : QSplitter( Qt::Horizontal, (QWidget *) parent->widgetRep() )
99 , _backButtonLabel( backButtonLabel )
100 , _abortButtonLabel( abortButtonLabel )
101 , _nextButtonLabel( nextButtonLabel )
104 setObjectName(
"wizard" );
105 setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
107 QHBoxLayout* layout =
new QHBoxLayout(
this );
108 layout->setSpacing( 0 );
109 layout->setMargin( 0 );
111 setWidgetRep(
this );
114 _stepsEnabled = ( (wizardMode == YWizardMode_Steps) || main_wizard );
115 _treeEnabled = (wizardMode == YWizardMode_Tree);
117 _stepsRegistered =
false;
119 _direction = YQWizard::Forward;
126 _releaseNotesButton = 0;
139 _sendButtonEvents =
true;
140 _contentsReplacePoint = 0;
142 _previousWindowIcon = topLevelWidget()->windowIcon();
148 if( topLevelWidget()->windowTitle().isEmpty() )
151 QPixmap pixmap ( YUI::app()->applicationIcon().c_str() );
152 if ( !pixmap.isNull() )
153 setWindowIcon ( QIcon ( pixmap ) );
156 layout->addLayout( layoutSideBar(
this ) );
157 layout->addWidget( layoutWorkArea(
this ) );
159 setStretchFactor(indexOf(_sideBar),0);
160 setStretchFactor(indexOf(_workArea),1);
164 if ( !_stepsEnabled )
165 QY2Styler::styler()->registerWidget(
this );
167 if ( !main_wizard && _stepsEnabled )
171 else if ( main_wizard )
183 if (
this == main_wizard )
187 else if ( main_wizard )
190 main_wizard->setSizes( sizes() );
195 QY2Styler::styler()->unregisterWidget(
this );
196 topLevelWidget()->setWindowIcon( _previousWindowIcon );
202 return this != main_wizard;
206 void YQWizard::layoutTitleBar( QWidget * parent )
208 QFrame * titleBar =
new QFrame( parent );
209 YUI_CHECK_NEW( titleBar );
211 QHBoxLayout *layout =
new QHBoxLayout( titleBar );
212 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
218 QLabel * left =
new QLabel( titleBar );
219 layout->addWidget( left );
220 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
221 left->setObjectName(
"titleBar-left" );
227 layout->addStretch( 10 );
234 QLabel * right =
new QLabel( titleBar );
235 YUI_CHECK_NEW( right );
237 layout->addWidget( right );
238 right->setObjectName(
"titleBar-right" );
242 QLayout *YQWizard::layoutSideBar( QWidget * parent )
244 _sideBar =
new QStackedWidget( parent );
245 YUI_CHECK_NEW( _sideBar );
247 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
248 _sideBar->setObjectName( QString(
"_sideBar-%1" ).arg(
long(
this ) ) );
249 _sideBar->installEventFilter(
this );
251 QVBoxLayout *vbox =
new QVBoxLayout( );
252 vbox->addWidget( _sideBar );
259 else if ( _stepsEnabled )
271 void YQWizard::layoutStepsPanel()
274 _stepsPanel =
new QFrame( _sideBar );
275 _sideBar->addWidget( _stepsPanel );
276 _stepsPanel->setObjectName(
"steps" );
277 QY2Styler::styler()->registerChildWidget(
this, _stepsPanel );
278 _stepsPanel->setProperty(
"class",
"steps QFrame" );
286 QString qId = fromUTF8(
id );
288 if ( _stepsIDs[ qId ] )
290 yuiError() <<
"Step ID \"" <<
id <<
"\" (\"" << text
291 <<
"\") already used for \"" << _stepsIDs[ qId ]->name() <<
"\""
296 if ( !_stepsList.empty() && _stepsList.last()->name() == fromUTF8( text ) )
304 _stepsList.last()->addID( qId );
312 _stepsIDs.insert( qId, _stepsList.last() );
315 if ( _currentStepID.isNull() )
316 _currentStepID = qId;
332 yuiDebug() <<
"updateSteps" << std::endl;
334 if ( !_stepsRegistered )
335 setUpdatesEnabled(
false);
338 delete _stepsPanel->layout();
339 _stepsPanel->setMaximumWidth( 65000 );
341 QVBoxLayout *_stepsVBox =
new QVBoxLayout( _stepsPanel );
343 QGridLayout *_stepsGrid =
new QGridLayout( );
344 _stepsGrid->setObjectName( QString(
"_stepsGrid_%1" ).arg(
long(
this ) ) );
345 YUI_CHECK_NEW( _stepsGrid );
346 _stepsVBox->addLayout( _stepsGrid );
347 _stepsGrid->setColumnMinimumWidth( 0, 10 );
348 _stepsGrid->setRowStretch( 0, 1 );
349 _stepsGrid->setRowStretch( 1, 1 );
350 _stepsGrid->setRowStretch( 2, 99 );
352 const int statusCol = 1;
353 const int nameCol = 2;
361 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
365 step->deleteLabels();
367 if ( step->isHeading() )
373 yuiDebug() <<
"Adding StepHeading \"" << step->name() <<
"\"" << std::endl;
374 QLabel * label =
new QLabel( step->name(), _stepsPanel );
375 YUI_CHECK_NEW( label );
376 label->setObjectName( step->name() );
377 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
378 label->setProperty(
"class",
"steps_heading" );
380 step->setNameLabel( label );
381 _stepsGrid->addWidget( label,
383 1, nameCol - statusCol + 1);
391 yuiDebug() <<
"Adding Step \"" << step->name() <<
"\"" << std::endl;
393 QLabel * statusLabel =
new QLabel( _stepsPanel );
394 YUI_CHECK_NEW( statusLabel );
396 step->setStatusLabel( statusLabel );
397 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
398 _stepsGrid->addWidget( statusLabel, row, statusCol );
404 QLabel * nameLabel =
new QLabel( step->name(), _stepsPanel );
405 YUI_CHECK_NEW( nameLabel );
406 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
407 nameLabel->setObjectName( step->name() );
409 step->setNameLabel( nameLabel );
410 _stepsGrid->addWidget( nameLabel, row, nameCol );
417 _stepsVBox->addStretch( 99 );
418 QVBoxLayout *rbl =
new QVBoxLayout();
419 rbl->addWidget( _releaseNotesButton, 0, Qt::AlignCenter );
421 _stepsVBox->addLayout( rbl );
422 _stepsVBox->addStretch( 29 );
426 if ( !_stepsRegistered )
428 QY2Styler::styler()->registerWidget(
this );
429 setUpdatesEnabled(
true );
430 QY2Styler::styler()->updateRendering(
this );
431 _stepsRegistered =
true;
438 yuiDebug() <<
"steps dirty: " << _stepsDirty << std::endl;
444 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
455 while ( step != _stepsList.end() && *step !=
currentStep )
457 ( *step )->setStatus( Step::Done );
463 if ( step != _stepsList.end() )
471 while ( step != _stepsList.end() )
473 ( *step )->setStatus( Step::Todo );
481 yuiDebug() <<
"Setting current step to \"" <<
id <<
"\"" << std::endl;
483 _currentStepID = fromUTF8(
id );
489 QList<Step*> _oldSteps = wizard->
stepsList();
491 if (_oldSteps.empty())
494 foreach(
Step *oldStep, _oldSteps)
498 if( !oldStep->isHeading() )
499 newStep =
new Step( oldStep->name());
503 foreach( QString oneId, oldStep->id())
505 newStep->addID( oneId);
506 _stepsIDs.insert( oneId, newStep );
509 newStep->setEnabled( oldStep->isEnabled());
510 _stepsList.append(newStep);
515 setSizes( main_wizard->sizes());
521 yuiDebug() <<
"Deleting steps" << std::endl;
524 _stepsPanel->setFixedWidth( _stepsPanel->width() );
526 qDeleteAll(_stepsList);
529 _currentStepID = QString::null;
539 return _stepsIDs[ id ];
543 void YQWizard::layoutTreePanel()
545 _treePanel =
new QFrame( _sideBar );
546 YUI_CHECK_NEW( _treePanel );
547 QHBoxLayout *layout =
new QHBoxLayout( _treePanel );
548 _sideBar->addWidget( _treePanel );
550 QVBoxLayout * vbox =
new QVBoxLayout();
551 YUI_CHECK_NEW( vbox );
552 layout->addLayout( vbox );
557 YUI_CHECK_NEW( _tree );
558 vbox->addWidget( _tree );
560 _tree->header()->hide();
561 _tree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
563 _tree->setRootIsDecorated(
true );
566 connect( _tree, &pclass(_tree)::itemSelectionChanged,
569 connect( _tree, &pclass(_tree)::itemDoubleClicked,
577 QString qId = fromUTF8(
id );
581 yuiError() <<
"YQWizard widget not created with `opt(`treeEnabled) !" << std::endl;
588 if ( ! parentID.empty() )
596 YUI_CHECK_NEW( item );
601 YUI_CHECK_NEW( item );
604 if ( ! qId.isEmpty() )
605 _treeIDs.insert( qId, item );
625 return _treeIDs[ fromUTF8(
id ) ];
639 _tree->setCurrentItem(item);
640 _tree->scrollToItem(item);
652 if ( item && ! item->id().isEmpty() )
669 QTreeWidgetItem * sel = _tree->currentItem();
675 if ( item && ! item->id().isEmpty() )
676 return toUTF8( item->id() );
680 return std::string();
685 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
687 _workArea =
new QFrame( parent );
689 QVBoxLayout *vbox =
new QVBoxLayout( _workArea );
690 YUI_CHECK_NEW( vbox );
693 if (YUI::application()->showProductLogo())
695 QWidget * logoWidget =
new QWidget;
696 logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
697 logoWidget->setObjectName(
"LogoHBox");
698 vbox->addWidget( logoWidget );
700 QHBoxLayout * logoHBox =
new QHBoxLayout(logoWidget);
701 YUI_CHECK_NEW( logoHBox );
703 _dialogLogo =
new QLabel( _workArea );
704 YUI_CHECK_NEW( _dialogLogo );
705 logoHBox->addWidget( _dialogLogo );
706 _dialogLogo->setObjectName(
"DialogLogo" );
707 _dialogLogo->setAlignment( Qt::AlignLeft );
708 QY2Styler::styler()->registerChildWidget(
this, _dialogLogo );
709 _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
710 _dialogLogo->setMinimumHeight(59);
711 _dialogLogo->setMinimumWidth(100);
712 logoHBox->addStretch();
719 _menuBar =
new QMenuBar( _workArea );
720 YUI_CHECK_NEW( _menuBar );
723 vbox->addWidget( _menuBar );
725 QWidget * dialog_inner_area =
new QWidget (_workArea);
726 dialog_inner_area->setObjectName(
"work_area" );
728 QY2Styler::styler()->registerChildWidget(
this, dialog_inner_area );
729 QVBoxLayout * inner_vbox =
new QVBoxLayout(dialog_inner_area);
730 YUI_CHECK_NEW( inner_vbox );
731 vbox->addWidget (dialog_inner_area);
733 QVBoxLayout *innerbox =
new QVBoxLayout( _workArea );
734 QVBoxLayout *leftInnerBox = innerbox;
735 QVBoxLayout *rightInnerBox = innerbox;
736 YUI_CHECK_NEW( innerbox );
738 innerbox->setMargin ( YQWidgetMargin );
740 inner_vbox->addLayout(innerbox);
741 vbox->setMargin( 0 );
748 if (titleIsOnTheLeft()) {
749 QHBoxLayout *bigHBox =
new QHBoxLayout();
750 innerbox->addLayout( bigHBox );
752 leftInnerBox =
new QVBoxLayout();
753 leftInnerBox->setObjectName(
"LeftInnerBox" );
754 bigHBox->addLayout( leftInnerBox );
755 bigHBox->setStretchFactor( leftInnerBox, 1 );
757 rightInnerBox =
new QVBoxLayout();
758 rightInnerBox->setObjectName(
"RightInnerBox" );
759 bigHBox->addLayout( rightInnerBox );
760 bigHBox->setStretchFactor( rightInnerBox, 2 );
763 QHBoxLayout * headingHBox =
new QHBoxLayout();
764 YUI_CHECK_NEW( headingHBox );
766 leftInnerBox->addLayout( headingHBox );
768 _dialogIcon =
new QLabel( _workArea );
769 YUI_CHECK_NEW( _dialogIcon );
770 headingHBox->addWidget( _dialogIcon );
771 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
772 _dialogIcon->setObjectName(
"DialogIcon" );
774 _dialogHeading =
new QLabel( _workArea );
775 YUI_CHECK_NEW( _dialogHeading );
776 headingHBox->addWidget( _dialogHeading );
777 _dialogHeading->setWordWrap(
true );
778 _dialogHeading->setTextFormat( Qt::PlainText );
779 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
780 _dialogHeading->setObjectName( (titleIsOnTheLeft())?
"DialogHeadingLeft" :
"DialogHeadingTop" ) ;
786 layoutClientArea( _workArea );
787 rightInnerBox->addWidget( _clientArea );
793 QLayout *bb = layoutButtonBox( _workArea );
794 innerbox->addLayout( bb );
801 void YQWizard::layoutClientArea( QWidget * parent )
803 _clientArea =
new QFrame( parent );
804 YUI_CHECK_NEW( _clientArea );
805 _clientArea->setObjectName(
"_clientArea");
806 QVBoxLayout *layout =
new QVBoxLayout( _clientArea );
807 layout->setMargin( 0 );
813 _contents =
new YQAlignment(
this, _clientArea, YAlignCenter, YAlignCenter );
814 YUI_CHECK_NEW( _contents );
815 layout->addWidget( _contents );
816 _contents->QObject::setProperty(
"class",
"Contents" );
818 _contents->setStretchable( YD_HORIZ,
true );
819 _contents->setStretchable( YD_VERT,
true );
820 _contents->installEventFilter(
this );
821 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
827 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
833 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
834 _contentsReplacePoint->showChild();
840 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
846 QHBoxLayout * hbox =
new QHBoxLayout();
847 YUI_CHECK_NEW( hbox );
849 hbox->setSpacing( 0 );
850 hbox->setMargin( 0 );
853 _helpButton =
new QPushButton( _(
"Help" ), parent );
854 YUI_CHECK_NEW( _helpButton );
855 _helpButton->setShortcut( Qt::Key_F1 );
857 connect( _helpButton, &pclass(_helpButton)::clicked,
860 hbox->addWidget( _helpButton );
862 hbox->addSpacing( 10 );
869 _releaseNotesButton =
new QPushButton( _(
"Release Notes" ), parent );
870 YUI_CHECK_NEW( _releaseNotesButton );
871 hbox->addWidget( _releaseNotesButton );
872 connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked,
876 if (_releaseNotesButtonId ==
"")
878 _releaseNotesButton->hide();
885 hbox->addStretch( 10 );
891 _abortButton =
new YQWizardButton(
this, parent, _abortButtonLabel );
892 YUI_CHECK_NEW( _abortButton );
894 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
895 connect( _abortButton, &pclass(_abortButton)::clicked,
898 hbox->addSpacing( 10 );
904 _backButton =
new YQWizardButton(
this, parent, _backButtonLabel );
905 YUI_CHECK_NEW( _backButton );
907 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
908 connect( _backButton, &pclass(_backButton)::clicked,
911 if ( _backButton->
text().isEmpty() )
918 hbox->addSpacing( 5 );
920 _nextButton =
new YQWizardButton(
this, parent, _nextButtonLabel );
921 YUI_CHECK_NEW( _nextButton );
923 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
924 connect( _nextButton, &pclass(_nextButton)::clicked,
930 bool YQWizard::titleIsOnTheLeft()
932 return wizardMode() == YWizardMode_TitleOnLeft;
950 if ( QString( signal ).contains(
"nextClicked()" ) )
952 yuiDebug() <<
"nextClicked connected, no longer directly sending button events" << std::endl;
953 _sendButtonEvents =
false;
960 if ( QString( signal ).contains(
"nextClicked()" ) )
962 yuiDebug() <<
"nextClicked disconnected, directly sending button events again" << std::endl;
963 _sendButtonEvents =
true;
972 if ( ! iconName.empty() )
974 QPixmap icon( iconName.c_str() );
977 yuiWarning() <<
"Couldn't load dialog icon \"" << iconName <<
"\"" << std::endl;
980 _dialogIcon->setPixmap( icon );
981 topLevelWidget()->setWindowIcon( icon );
986 _dialogIcon->clear();
987 topLevelWidget()->setWindowIcon( QIcon() );
995 QString title = fromUTF8( titleText.c_str() );
997 if ( !title.isEmpty() )
1006 if ( _dialogHeading )
1008 if ( ! headingText.empty() )
1009 _dialogHeading->setText( fromUTF8( headingText ) );
1011 _dialogHeading->clear();
1017 if ( _dialogHeading )
1019 QString label = _dialogHeading->text();
1020 label = label.simplified();
1022 if ( ! label.isEmpty() )
1023 return toUTF8( label );
1026 return "untitled YQWizard";
1032 _qHelpText = fromUTF8( helpText );
1033 _qHelpText.replace(
"&product;", fromUTF8( YUI::app()->productName() ) );
1041 if ( _sendButtonEvents )
1044 _direction = YQWizard::Backward;
1052 if ( _sendButtonEvents )
1061 if ( _sendButtonEvents )
1064 _direction = YQWizard::Forward;
1075 _helpDlg->setHelpText( _qHelpText );
1081 _helpDlg->activateWindow();
1088 YDialog::showRelNotesText();
1094 if ( _sideBar && _stepsPanel )
1096 _sideBar->setCurrentWidget( _stepsPanel );
1103 if ( _sideBar && _treePanel )
1105 _sideBar->setCurrentWidget( _treePanel );
1111 const std::string &
id )
1115 QMenu * menu =
new QMenu( _menuBar );
1116 YUI_CHECK_NEW( menu );
1118 _menuIDs.insert( fromUTF8(
id ), menu );
1119 _menuBar->addMenu( menu );
1120 menu->setTitle( fromUTF8( text ) );
1122 connect( menu, &pclass(menu)::triggered,
1131 const std::string & text,
1132 const std::string &
id )
1134 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1138 QMenu * menu =
new QMenu( _menuBar );
1139 YUI_CHECK_NEW( menu );
1141 _menuIDs.insert( fromUTF8(
id ), menu );
1144 connect( menu, &pclass(menu)::triggered,
1149 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1155 const std::string & text,
1156 const std::string & idString )
1158 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1163 int id = _menuEntryIDs.size();
1166 action = parentMenu->addAction( fromUTF8( text ) );
1167 _menuEntryIDs[ action ] = idString ;
1172 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1179 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1183 parentMenu->addSeparator();
1187 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1199 _menuEntryIDs.clear();
1206 if ( _menuEntryIDs.contains( action ) )
1212 yuiError() <<
"Invalid menu ID " << std::endl;
1225 return sizeHint().width();
1231 return sizeHint().height();
1237 resize( newWidth, newHeight );
1243 QSize contentsRect = _clientArea->contentsRect().size();
1244 _contents->
setSize( contentsRect.width(), contentsRect.height() );
1249 if ( ev->type() == QEvent::Resize && obj == _contents )
1255 if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
1261 return QWidget::eventFilter( obj, ev );
1267 button->setLabel( newLabel );
1268 YDialog::currentDialog()->checkShortcuts();
1272 if ( wizardButton ) {
1274 if ( newLabel.empty() )
1275 wizardButton->
hide();
1277 wizardButton->
show();
1284 if ( ! _releaseNotesButton )
1286 yuiError() <<
"NULL Release Notes button" << std::endl;
1288 if ( ! _stepsPanel )
1289 yuiError() <<
"This works only if there is a \"steps\" panel!" << std::endl;
1295 _releaseNotesButton->setText( fromUTF8( YShortcut::cleanShortcutString( label ) ) );
1296 _releaseNotesButtonId = id;
1297 _releaseNotesButtonLabel = label;
1299 _releaseNotesButton->show();
1305 if ( _releaseNotesButton && !_releaseNotesButton->isHidden() )
1307 _releaseNotesButton->hide();
1308 _releaseNotesButtonId =
"";
1309 _releaseNotesButtonLabel =
"";
1320 _helpButton->setText( _(
"Help" ) );
1324 _stepsButton->setText( _(
"Steps" ) );
1328 _treeButton->setText( _(
"Tree" ) );
1331 _helpDlg->retranslate();
1336 void YQWizard::Step::deleteLabels()
1338 delete _statusLabel;
1353 if ( !_statusLabel || !_nameLabel || _status == s )
1360 _statusLabel->setProperty(
"class",
"todo-step-status QLabel" );
1361 _nameLabel->setProperty (
"class",
"todo-step-name QLabel" );
1366 _statusLabel->setProperty(
"class",
"done-step-status QLabel" );
1367 _nameLabel->setProperty (
"class",
"done-step-name QLabel" );
1372 _statusLabel->setProperty(
"class",
"current-step-status QLabel" );
1373 _nameLabel->setProperty (
"class",
"current-step-name QLabel" );
1376 _statusLabel->style()->unpolish( _statusLabel );
1377 _statusLabel->style()->polish( _statusLabel );
1378 _nameLabel->style()->unpolish( _nameLabel );
1379 _nameLabel->style()->polish( _nameLabel );
1382 #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 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.