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 )
185 if (
this == main_wizard )
189 else if ( main_wizard )
192 main_wizard->setSizes( sizes() );
198 QY2Styler::styler()->unregisterWidget(
this );
199 topLevelWidget()->setWindowIcon( _previousWindowIcon );
205 return this != main_wizard;
209 void YQWizard::layoutTitleBar( QWidget * parent )
211 QFrame * titleBar =
new QFrame( parent );
212 YUI_CHECK_NEW( titleBar );
214 QHBoxLayout *layout =
new QHBoxLayout( titleBar );
215 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
221 QLabel * left =
new QLabel( titleBar );
222 layout->addWidget( left );
223 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
224 left->setObjectName(
"titleBar-left" );
230 layout->addStretch( 10 );
237 QLabel * right =
new QLabel( titleBar );
238 YUI_CHECK_NEW( right );
240 layout->addWidget( right );
241 right->setObjectName(
"titleBar-right" );
245 QLayout *YQWizard::layoutSideBar( QWidget * parent )
247 _sideBar =
new QStackedWidget( parent );
248 YUI_CHECK_NEW( _sideBar );
250 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
251 _sideBar->setObjectName( QString(
"_sideBar-%1" ).arg(
long(
this ) ) );
252 _sideBar->installEventFilter(
this );
254 QVBoxLayout *vbox =
new QVBoxLayout( );
255 vbox->addWidget( _sideBar );
262 else if ( _stepsEnabled )
274 void YQWizard::layoutStepsPanel()
277 _stepsPanel =
new QFrame( _sideBar );
278 _sideBar->addWidget( _stepsPanel );
279 _stepsPanel->setObjectName(
"steps" );
280 QY2Styler::styler()->registerChildWidget(
this, _stepsPanel );
281 _stepsPanel->setProperty(
"class",
"steps QFrame" );
289 QString qId = fromUTF8(
id );
291 if ( _stepsIDs[ qId ] )
293 yuiError() <<
"Step ID \"" <<
id <<
"\" (\"" << text
294 <<
"\") already used for \"" << _stepsIDs[ qId ]->name() <<
"\"" 299 if ( !_stepsList.empty() && _stepsList.last()->name() == fromUTF8( text ) )
307 _stepsList.last()->addID( qId );
315 _stepsIDs.insert( qId, _stepsList.last() );
318 if ( _currentStepID.isNull() )
319 _currentStepID = qId;
335 yuiDebug() <<
"updateSteps" << std::endl;
337 if ( !_stepsRegistered )
338 setUpdatesEnabled(
false);
341 delete _stepsPanel->layout();
342 _stepsPanel->setMaximumWidth( 65000 );
344 QVBoxLayout *_stepsVBox =
new QVBoxLayout( _stepsPanel );
346 QGridLayout *_stepsGrid =
new QGridLayout( );
347 _stepsGrid->setObjectName( QString(
"_stepsGrid_%1" ).arg(
long(
this ) ) );
348 YUI_CHECK_NEW( _stepsGrid );
349 _stepsVBox->addLayout( _stepsGrid );
350 _stepsGrid->setColumnMinimumWidth( 0, 10 );
351 _stepsGrid->setRowStretch( 0, 1 );
352 _stepsGrid->setRowStretch( 1, 1 );
353 _stepsGrid->setRowStretch( 2, 99 );
355 const int statusCol = 1;
356 const int nameCol = 2;
364 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
368 step->deleteLabels();
370 if ( step->isHeading() )
376 yuiDebug() <<
"Adding StepHeading \"" << step->name() <<
"\"" << std::endl;
377 QLabel * label =
new QLabel( step->name(), _stepsPanel );
378 YUI_CHECK_NEW( label );
379 label->setObjectName( step->name() );
380 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
381 label->setProperty(
"class",
"steps_heading" );
383 step->setNameLabel( label );
384 _stepsGrid->addWidget( label,
386 1, nameCol - statusCol + 1);
394 yuiDebug() <<
"Adding Step \"" << step->name() <<
"\"" << std::endl;
396 QLabel * statusLabel =
new QLabel( _stepsPanel );
397 YUI_CHECK_NEW( statusLabel );
399 step->setStatusLabel( statusLabel );
400 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
401 _stepsGrid->addWidget( statusLabel, row, statusCol );
407 QLabel * nameLabel =
new QLabel( step->name(), _stepsPanel );
408 YUI_CHECK_NEW( nameLabel );
409 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
410 nameLabel->setObjectName( step->name() );
412 step->setNameLabel( nameLabel );
413 _stepsGrid->addWidget( nameLabel, row, nameCol );
420 _stepsVBox->addStretch( 99 );
421 QVBoxLayout *rbl =
new QVBoxLayout();
422 rbl->addWidget( (QWidget *) _releaseNotesButton->widgetRep(), 0, Qt::AlignCenter );
424 _stepsVBox->addLayout( rbl );
425 _stepsVBox->addStretch( 29 );
429 if ( !_stepsRegistered )
431 QY2Styler::styler()->registerWidget(
this );
432 setUpdatesEnabled(
true );
433 QY2Styler::styler()->updateRendering(
this );
434 _stepsRegistered =
true;
441 yuiDebug() <<
"steps dirty: " << _stepsDirty << std::endl;
447 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
458 while ( step != _stepsList.end() && *step !=
currentStep )
460 ( *step )->setStatus( Step::Done );
466 if ( step != _stepsList.end() )
474 while ( step != _stepsList.end() )
476 ( *step )->setStatus( Step::Todo );
484 yuiDebug() <<
"Setting current step to \"" <<
id <<
"\"" << std::endl;
486 _currentStepID = fromUTF8(
id );
492 QList<Step*> _oldSteps = wizard->
stepsList();
494 if (_oldSteps.empty())
497 foreach(
Step *oldStep, _oldSteps)
501 if( !oldStep->isHeading() )
502 newStep =
new Step( oldStep->name());
506 foreach( QString oneId, oldStep->id())
508 newStep->addID( oneId);
509 _stepsIDs.insert( oneId, newStep );
512 newStep->setEnabled( oldStep->isEnabled());
513 _stepsList.append(newStep);
518 setSizes( main_wizard->sizes());
524 yuiDebug() <<
"Deleting steps" << std::endl;
527 _stepsPanel->setFixedWidth( _stepsPanel->width() );
529 qDeleteAll(_stepsList);
532 _currentStepID = QString::null;
542 return _stepsIDs[ id ];
546 void YQWizard::layoutTreePanel()
548 _treePanel =
new QFrame( _sideBar );
549 YUI_CHECK_NEW( _treePanel );
550 QHBoxLayout *layout =
new QHBoxLayout( _treePanel );
551 _sideBar->addWidget( _treePanel );
553 QVBoxLayout * vbox =
new QVBoxLayout();
554 YUI_CHECK_NEW( vbox );
555 layout->addLayout( vbox );
560 YUI_CHECK_NEW( _tree );
561 vbox->addWidget( _tree );
563 _tree->header()->hide();
564 _tree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
566 _tree->setRootIsDecorated(
true );
569 connect( _tree, &pclass(_tree)::itemSelectionChanged,
572 connect( _tree, &pclass(_tree)::itemDoubleClicked,
580 QString qId = fromUTF8(
id );
584 yuiError() <<
"YQWizard widget not created with `opt(`treeEnabled) !" << std::endl;
591 if ( ! parentID.empty() )
599 YUI_CHECK_NEW( item );
604 YUI_CHECK_NEW( item );
607 if ( ! qId.isEmpty() )
608 _treeIDs.insert( qId, item );
628 return _treeIDs[ fromUTF8(
id ) ];
642 _tree->setCurrentItem(item);
643 _tree->scrollToItem(item);
655 if ( item && ! item->id().isEmpty() )
672 QTreeWidgetItem * sel = _tree->currentItem();
678 if ( item && ! item->id().isEmpty() )
679 return toUTF8( item->id() );
683 return std::string();
688 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
690 _workArea =
new QFrame( parent );
692 QVBoxLayout *vbox =
new QVBoxLayout( _workArea );
693 YUI_CHECK_NEW( vbox );
696 if (YUI::application()->showProductLogo())
698 QWidget * logoWidget =
new QWidget;
699 logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
700 logoWidget->setObjectName(
"LogoHBox");
701 vbox->addWidget( logoWidget );
703 QHBoxLayout * logoHBox =
new QHBoxLayout(logoWidget);
704 YUI_CHECK_NEW( logoHBox );
706 _dialogLogo =
new QLabel( _workArea );
707 YUI_CHECK_NEW( _dialogLogo );
708 logoHBox->addWidget( _dialogLogo );
709 _dialogLogo->setObjectName(
"DialogLogo" );
710 _dialogLogo->setAlignment( Qt::AlignLeft );
711 QY2Styler::styler()->registerChildWidget(
this, _dialogLogo );
712 _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
713 _dialogLogo->setMinimumHeight(59);
714 _dialogLogo->setMinimumWidth(100);
715 logoHBox->addStretch();
722 _menuBar =
new QMenuBar( _workArea );
723 YUI_CHECK_NEW( _menuBar );
726 vbox->addWidget( _menuBar );
728 QWidget * dialog_inner_area =
new QWidget (_workArea);
729 dialog_inner_area->setObjectName(
"work_area" );
731 QY2Styler::styler()->registerChildWidget(
this, dialog_inner_area );
732 QVBoxLayout * inner_vbox =
new QVBoxLayout(dialog_inner_area);
733 YUI_CHECK_NEW( inner_vbox );
734 vbox->addWidget (dialog_inner_area);
736 QVBoxLayout *innerbox =
new QVBoxLayout( _workArea );
737 QVBoxLayout *leftInnerBox = innerbox;
738 QVBoxLayout *rightInnerBox = innerbox;
739 YUI_CHECK_NEW( innerbox );
741 innerbox->setMargin ( YQWidgetMargin );
743 inner_vbox->addLayout(innerbox);
744 vbox->setMargin( 0 );
751 if (titleIsOnTheLeft()) {
752 QHBoxLayout *bigHBox =
new QHBoxLayout();
753 innerbox->addLayout( bigHBox );
755 leftInnerBox =
new QVBoxLayout();
756 leftInnerBox->setObjectName(
"LeftInnerBox" );
757 bigHBox->addLayout( leftInnerBox );
758 bigHBox->setStretchFactor( leftInnerBox, 1 );
760 rightInnerBox =
new QVBoxLayout();
761 rightInnerBox->setObjectName(
"RightInnerBox" );
762 bigHBox->addLayout( rightInnerBox );
763 bigHBox->setStretchFactor( rightInnerBox, 2 );
766 QHBoxLayout * headingHBox =
new QHBoxLayout();
767 YUI_CHECK_NEW( headingHBox );
769 leftInnerBox->addLayout( headingHBox );
771 _dialogIcon =
new QLabel( _workArea );
772 YUI_CHECK_NEW( _dialogIcon );
773 headingHBox->addWidget( _dialogIcon );
774 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
775 _dialogIcon->setObjectName(
"DialogIcon" );
777 _dialogHeading =
new QLabel( _workArea );
778 YUI_CHECK_NEW( _dialogHeading );
779 headingHBox->addWidget( _dialogHeading );
780 _dialogHeading->setWordWrap(
true );
781 _dialogHeading->setTextFormat( Qt::PlainText );
782 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
783 _dialogHeading->setObjectName( (titleIsOnTheLeft())?
"DialogHeadingLeft" :
"DialogHeadingTop" ) ;
789 layoutClientArea( _workArea );
790 rightInnerBox->addWidget( _clientArea );
796 QLayout *bb = layoutButtonBox( _workArea );
797 innerbox->addLayout( bb );
804 void YQWizard::layoutClientArea( QWidget * parent )
806 _clientArea =
new QFrame( parent );
807 YUI_CHECK_NEW( _clientArea );
808 _clientArea->setObjectName(
"_clientArea");
809 QVBoxLayout *layout =
new QVBoxLayout( _clientArea );
810 layout->setMargin( 0 );
816 _contents =
new YQAlignment(
this, _clientArea, YAlignCenter, YAlignCenter );
817 YUI_CHECK_NEW( _contents );
818 layout->addWidget( _contents );
819 _contents->QObject::setProperty(
"class",
"Contents" );
821 _contents->setStretchable( YD_HORIZ,
true );
822 _contents->setStretchable( YD_VERT,
true );
823 _contents->installEventFilter(
this );
824 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
830 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
836 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
837 _contentsReplacePoint->showChild();
843 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
849 QHBoxLayout * hbox =
new QHBoxLayout();
850 YUI_CHECK_NEW( hbox );
852 hbox->setSpacing( 0 );
853 hbox->setMargin( 0 );
857 _helpButton =
new YQWizardButton(
this, parent, _(
"&Help" ).toStdString());
858 YUI_CHECK_NEW( _helpButton );
861 connect( _helpButton, &pclass(_helpButton)::clicked,
864 hbox->addWidget( (QWidget *) _helpButton->widgetRep() );
866 hbox->addSpacing( 10 );
874 _releaseNotesButton =
new YQWizardButton(
this, parent, _(
"&Release Notes" ).toStdString ());
875 YUI_CHECK_NEW( _releaseNotesButton );
876 hbox->addWidget( (QWidget *) _releaseNotesButton->widgetRep() );
877 connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked,
881 if (_releaseNotesButtonId ==
"")
883 _releaseNotesButton->
hide();
890 hbox->addStretch( 10 );
896 _abortButton =
new YQWizardButton(
this, parent, _abortButtonLabel );
897 YUI_CHECK_NEW( _abortButton );
899 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
900 connect( _abortButton, &pclass(_abortButton)::clicked,
903 hbox->addSpacing( 10 );
909 _backButton =
new YQWizardButton(
this, parent, _backButtonLabel );
910 YUI_CHECK_NEW( _backButton );
912 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
913 connect( _backButton, &pclass(_backButton)::clicked,
916 if ( _backButton->
text().isEmpty() )
923 hbox->addSpacing( 5 );
925 _nextButton =
new YQWizardButton(
this, parent, _nextButtonLabel );
926 YUI_CHECK_NEW( _nextButton );
928 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
929 connect( _nextButton, &pclass(_nextButton)::clicked,
935 bool YQWizard::titleIsOnTheLeft()
937 return wizardMode() == YWizardMode_TitleOnLeft;
955 if ( QString( signal ).contains(
"nextClicked()" ) )
957 yuiDebug() <<
"nextClicked connected, no longer directly sending button events" << std::endl;
958 _sendButtonEvents =
false;
965 if ( QString( signal ).contains(
"nextClicked()" ) )
967 yuiDebug() <<
"nextClicked disconnected, directly sending button events again" << std::endl;
968 _sendButtonEvents =
true;
977 if ( ! iconName.empty() )
979 QPixmap icon( iconName.c_str() );
982 yuiWarning() <<
"Couldn't load dialog icon \"" << iconName <<
"\"" << std::endl;
985 _dialogIcon->setPixmap( icon );
986 topLevelWidget()->setWindowIcon( icon );
991 _dialogIcon->clear();
992 topLevelWidget()->setWindowIcon( QIcon() );
1000 QString title = fromUTF8( titleText.c_str() );
1002 if ( !title.isEmpty() )
1011 if ( _dialogHeading )
1013 if ( ! headingText.empty() )
1014 _dialogHeading->setText( fromUTF8( headingText ) );
1016 _dialogHeading->clear();
1022 if ( _dialogHeading )
1024 QString label = _dialogHeading->text();
1025 label = label.simplified();
1027 if ( ! label.isEmpty() )
1028 return toUTF8( label );
1031 return "untitled YQWizard";
1037 _qHelpText = fromUTF8( helpText );
1038 _qHelpText.replace(
"&product;", fromUTF8( YUI::app()->productName() ) );
1046 if ( _sendButtonEvents )
1049 _direction = YQWizard::Backward;
1057 if ( _sendButtonEvents )
1066 if ( _sendButtonEvents )
1069 _direction = YQWizard::Forward;
1080 _helpDlg->setHelpText( _qHelpText );
1086 _helpDlg->activateWindow();
1096 _relNotesDlg->hide();
1099 std::map<std::string,std::string> relnotes = YUI::application()->releaseNotes();
1100 if ( relnotes.size() == 0)
1104 _relNotesDlg->setRelNotes( relnotes );
1105 _relNotesDlg->show();
1106 _relNotesDlg->raise();
1107 _relNotesDlg->activateWindow();
1113 if ( _sideBar && _stepsPanel )
1115 _sideBar->setCurrentWidget( _stepsPanel );
1122 if ( _sideBar && _treePanel )
1124 _sideBar->setCurrentWidget( _treePanel );
1130 const std::string &
id )
1134 QMenu * menu =
new QMenu( _menuBar );
1135 YUI_CHECK_NEW( menu );
1137 _menuIDs.insert( fromUTF8(
id ), menu );
1138 _menuBar->addMenu( menu );
1139 menu->setTitle( fromUTF8( text ) );
1141 connect( menu, &pclass(menu)::triggered,
1150 const std::string & text,
1151 const std::string &
id )
1153 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1157 QMenu * menu =
new QMenu( _menuBar );
1158 YUI_CHECK_NEW( menu );
1160 _menuIDs.insert( fromUTF8(
id ), menu );
1163 connect( menu, &pclass(menu)::triggered,
1168 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1174 const std::string & text,
1175 const std::string & idString )
1177 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1182 int id = _menuEntryIDs.size();
1185 action = parentMenu->addAction( fromUTF8( text ) );
1186 _menuEntryIDs[ action ] = idString ;
1191 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1198 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1202 parentMenu->addSeparator();
1206 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1218 _menuEntryIDs.clear();
1225 if ( _menuEntryIDs.contains( action ) )
1231 yuiError() <<
"Invalid menu ID " << std::endl;
1244 return sizeHint().width();
1250 return sizeHint().height();
1256 resize( newWidth, newHeight );
1262 QSize contentsRect = _clientArea->contentsRect().size();
1263 _contents->
setSize( contentsRect.width(), contentsRect.height() );
1268 if ( ev->type() == QEvent::Resize && obj == _contents )
1274 if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
1280 return QWidget::eventFilter( obj, ev );
1286 button->setLabel( newLabel );
1287 YDialog::currentDialog()->checkShortcuts();
1291 if ( wizardButton ) {
1293 if ( newLabel.empty() )
1294 wizardButton->
hide();
1296 wizardButton->
show();
1303 if ( ! _releaseNotesButton )
1305 yuiError() <<
"NULL Release Notes button" << std::endl;
1307 if ( ! _stepsPanel )
1308 yuiError() <<
"This works only if there is a \"steps\" panel!" << std::endl;
1314 _releaseNotesButton->
setLabel( fromUTF8( label ) );
1315 _releaseNotesButtonId = id;
1316 _releaseNotesButtonLabel = label;
1318 _releaseNotesButton->
show();
1324 if ( _releaseNotesButton && !_releaseNotesButton->
isHidden() )
1326 _releaseNotesButton->
hide();
1327 _releaseNotesButtonId =
"";
1328 _releaseNotesButtonLabel =
"";
1340 _helpButton->
setLabel( _(
"&Help" ) );
1345 _stepsButton->setText( _(
"&Steps" ) );
1350 _treeButton->setText( _(
"&Tree" ) );
1352 if ( _releaseNotesButton )
1355 _releaseNotesButton->
setLabel( _(
"&Release Notes" ) );
1358 _helpDlg->retranslate();
1361 _relNotesDlg->retranslate();
1366 void YQWizard::Step::deleteLabels()
1368 delete _statusLabel;
1383 if ( !_statusLabel || !_nameLabel || _status == s )
1390 _statusLabel->setProperty(
"class",
"todo-step-status QLabel" );
1391 _nameLabel->setProperty (
"class",
"todo-step-name QLabel" );
1396 _statusLabel->setProperty(
"class",
"done-step-status QLabel" );
1397 _nameLabel->setProperty (
"class",
"done-step-name QLabel" );
1402 _statusLabel->setProperty(
"class",
"current-step-status QLabel" );
1403 _nameLabel->setProperty (
"class",
"current-step-name QLabel" );
1406 _statusLabel->style()->unpolish( _statusLabel );
1407 _statusLabel->style()->polish( _statusLabel );
1408 _nameLabel->style()->unpolish( _nameLabel );
1409 _nameLabel->style()->polish( _nameLabel );
1412 #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.
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.
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.
bool isSecondary() const
Returns true if the wizard should follow the first wizard with steps.
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.
virtual std::string debugLabel() const
Returns a descriptive label of this dialog instance for debugging.