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> 51 #include "QY2ListView.h" 52 #include "QY2Styler.h" 53 #include "QY2HelpDialog.h" 54 #include "QY2RelNotesDialog.h" 55 #include <QGridLayout> 56 #include <QHeaderView> 62 #include "YQApplication.h" 64 #include "YQAlignment.h" 65 #include "YQReplacePoint.h" 68 #include "YQWizardButton.h" 69 #include "YQWidgetFactory.h" 70 #include "YQSignalBlocker.h" 71 #include <yui/YEvent.h> 72 #include "YQMainWinDock.h" 81 #define TEXTDOMAIN "qt" 83 #define USE_ICON_ON_HELP_BUTTON 0 86 std::string YQWizard::_releaseNotesButtonId =
"";
87 std::string YQWizard::_releaseNotesButtonLabel =
"";
90 const std::string & backButtonLabel,
91 const std::string & abortButtonLabel,
92 const std::string & nextButtonLabel,
93 YWizardMode wizardMode )
94 : QSplitter( Qt::Horizontal, (QWidget *) parent->widgetRep() )
101 , _backButtonLabel( backButtonLabel )
102 , _abortButtonLabel( abortButtonLabel )
103 , _nextButtonLabel( nextButtonLabel )
105 , _hotkeysDlg ( NULL )
106 , _relNotesDlg ( NULL )
108 setObjectName(
"wizard" );
109 setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
111 QHBoxLayout* layout =
new QHBoxLayout(
this );
112 layout->setSpacing( 0 );
113 layout->setMargin( 0 );
115 setWidgetRep(
this );
118 _stepsEnabled = (wizardMode == YWizardMode_Steps);
119 _treeEnabled = (wizardMode == YWizardMode_Tree);
121 _stepsRegistered =
false;
123 _direction = YQWizard::Forward;
130 _releaseNotesButton = 0;
143 _sendButtonEvents =
true;
144 _contentsReplacePoint = 0;
146 _previousWindowIcon = topLevelWidget()->windowIcon();
150 if( topLevelWidget()->windowTitle().isEmpty() )
153 QString icon_name = QFileInfo( YUI::app()->applicationIcon().c_str() ).baseName();
154 setWindowIcon ( QIcon::fromTheme( icon_name, QIcon( YUI::app()->applicationIcon().c_str() ) ) );
157 layout->addLayout( layoutSideBar(
this ) );
158 layout->addWidget( layoutWorkArea(
this ) );
160 setStretchFactor( indexOf( _sideBar ), 0 );
161 setStretchFactor( indexOf( _workArea ), 1 );
162 setCollapsible( indexOf( _sideBar ),
false );
166 if ( !_stepsEnabled )
173 else if ( main_wizard )
180 topLevelWidget()->activateWindow();
188 if (
this == main_wizard )
192 else if ( main_wizard )
195 main_wizard->setSizes( sizes() );
203 topLevelWidget()->setWindowIcon( _previousWindowIcon );
209 return this != main_wizard;
213 void YQWizard::layoutTitleBar( QWidget * parent )
215 QFrame * titleBar =
new QFrame( parent );
216 YUI_CHECK_NEW( titleBar );
218 QHBoxLayout *layout =
new QHBoxLayout( titleBar );
219 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
225 QLabel * left =
new QLabel( titleBar );
226 layout->addWidget( left );
227 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
228 left->setObjectName(
"titleBar-left" );
234 layout->addStretch( 10 );
241 QLabel * right =
new QLabel( titleBar );
242 YUI_CHECK_NEW( right );
244 layout->addWidget( right );
245 right->setObjectName(
"titleBar-right" );
249 QLayout *YQWizard::layoutSideBar( QWidget * parent )
251 _sideBar =
new QStackedWidget( parent );
252 YUI_CHECK_NEW( _sideBar );
254 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
255 _sideBar->setObjectName( QString(
"_sideBar-%1" ).arg(
long(
this ) ) );
256 _sideBar->installEventFilter(
this );
258 QVBoxLayout *vbox =
new QVBoxLayout( );
259 vbox->addWidget( _sideBar );
266 else if ( _stepsEnabled )
278 void YQWizard::layoutStepsPanel()
281 _stepsPanel =
new QFrame( _sideBar );
282 _sideBar->addWidget( _stepsPanel );
283 _sideBar->setObjectName(
"steps" );
284 _sideBar->setProperty(
"class",
"steps" );
293 QString qId = fromUTF8(
id );
295 if ( _stepsIDs[ qId ] )
297 yuiError() <<
"Step ID \"" <<
id <<
"\" (\"" << text
298 <<
"\") already used for \"" << _stepsIDs[ qId ]->name() <<
"\"" 303 if ( !_stepsList.empty() && _stepsList.last()->name() == fromUTF8( text ) )
311 _stepsList.last()->addID( qId );
319 _stepsIDs.insert( qId, _stepsList.last() );
322 if ( _currentStepID.isNull() )
323 _currentStepID = qId;
339 yuiDebug() <<
"updateSteps" << std::endl;
341 if ( !_stepsRegistered )
342 setUpdatesEnabled(
false);
345 delete _stepsPanel->layout();
346 _stepsPanel->setMaximumWidth( 65000 );
348 QVBoxLayout *_stepsVBox =
new QVBoxLayout( _stepsPanel );
350 QGridLayout *_stepsGrid =
new QGridLayout( );
351 _stepsGrid->setObjectName( QString(
"_stepsGrid_%1" ).arg(
long(
this ) ) );
352 YUI_CHECK_NEW( _stepsGrid );
353 _stepsVBox->addLayout( _stepsGrid );
354 _stepsGrid->setColumnMinimumWidth( 0, 10 );
355 _stepsGrid->setRowStretch( 0, 1 );
356 _stepsGrid->setRowStretch( 1, 1 );
357 _stepsGrid->setRowStretch( 2, 99 );
359 const int statusCol = 1;
360 const int nameCol = 2;
368 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
372 step->deleteLabels();
374 if ( step->isHeading() )
380 yuiDebug() <<
"Adding StepHeading \"" << step->name() <<
"\"" << std::endl;
381 QLabel * label =
new QLabel( step->name(), _stepsPanel );
382 YUI_CHECK_NEW( label );
383 label->setObjectName( step->name() );
384 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
385 label->setProperty(
"class",
"steps_heading" );
387 step->setNameLabel( label );
388 _stepsGrid->addWidget( label,
390 1, nameCol - statusCol + 1);
398 yuiDebug() <<
"Adding Step \"" << step->name() <<
"\"" << std::endl;
400 QLabel * statusLabel =
new QLabel( _stepsPanel );
401 YUI_CHECK_NEW( statusLabel );
403 step->setStatusLabel( statusLabel );
404 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
405 _stepsGrid->addWidget( statusLabel, row, statusCol );
411 QLabel * nameLabel =
new QLabel( step->name(), _stepsPanel );
412 YUI_CHECK_NEW( nameLabel );
413 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
414 nameLabel->setObjectName( step->name() );
416 step->setNameLabel( nameLabel );
417 _stepsGrid->addWidget( nameLabel, row, nameCol );
424 _stepsVBox->addStretch( 99 );
425 QVBoxLayout *rbl =
new QVBoxLayout();
426 rbl->addWidget( (QWidget *) _releaseNotesButton->widgetRep(), 0, Qt::AlignCenter );
428 _stepsVBox->addLayout( rbl );
429 _stepsVBox->addStretch( 1 );
433 if ( !_stepsRegistered )
436 setUpdatesEnabled(
true );
437 QY2Styler::styler()->updateRendering(
this );
438 _stepsRegistered =
true;
445 yuiDebug() <<
"steps dirty: " << _stepsDirty << std::endl;
451 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
462 while ( step != _stepsList.end() && *step !=
currentStep )
464 ( *step )->setStatus( Step::Done );
470 if ( step != _stepsList.end() )
478 while ( step != _stepsList.end() )
480 ( *step )->setStatus( Step::Todo );
488 yuiDebug() <<
"Setting current step to \"" <<
id <<
"\"" << std::endl;
490 _currentStepID = fromUTF8(
id );
496 QList<Step*> _oldSteps = wizard->
stepsList();
498 if (_oldSteps.empty())
501 foreach(
Step *oldStep, _oldSteps)
505 if( !oldStep->isHeading() )
506 newStep =
new Step( oldStep->name());
510 foreach( QString oneId, oldStep->id())
512 newStep->addID( oneId);
513 _stepsIDs.insert( oneId, newStep );
516 newStep->setEnabled( oldStep->isEnabled());
517 _stepsList.append(newStep);
522 setSizes( main_wizard->sizes());
528 yuiDebug() <<
"Deleting steps" << std::endl;
531 _stepsPanel->setFixedWidth( _stepsPanel->width() );
533 qDeleteAll(_stepsList);
536 _currentStepID = QString::null;
546 return _stepsIDs[ id ];
550 void YQWizard::layoutTreePanel()
552 _treePanel =
new QFrame( _sideBar );
553 YUI_CHECK_NEW( _treePanel );
554 QHBoxLayout *layout =
new QHBoxLayout( _treePanel );
555 _sideBar->addWidget( _treePanel );
557 QVBoxLayout * vbox =
new QVBoxLayout();
558 YUI_CHECK_NEW( vbox );
559 layout->addLayout( vbox );
564 YUI_CHECK_NEW( _tree );
565 vbox->addWidget( _tree );
567 _tree->header()->hide();
568 _tree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
570 _tree->setRootIsDecorated(
true );
573 connect( _tree, &pclass(_tree)::itemSelectionChanged,
576 connect( _tree, &pclass(_tree)::itemDoubleClicked,
584 QString qId = fromUTF8(
id );
588 yuiError() <<
"YQWizard widget not created with `opt(`treeEnabled) !" << std::endl;
595 if ( ! parentID.empty() )
603 YUI_CHECK_NEW( item );
608 YUI_CHECK_NEW( item );
611 if ( ! qId.isEmpty() )
612 _treeIDs.insert( qId, item );
632 return _treeIDs[ fromUTF8(
id ) ];
646 _tree->setCurrentItem(item);
647 _tree->scrollToItem(item);
659 if ( item && ! item->id().isEmpty() )
676 QTreeWidgetItem * sel = _tree->currentItem();
682 if ( item && ! item->id().isEmpty() )
683 return toUTF8( item->id() );
687 return std::string();
692 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
694 _workArea =
new QFrame( parent );
696 QVBoxLayout *vbox =
new QVBoxLayout( _workArea );
697 YUI_CHECK_NEW( vbox );
700 if (YUI::application()->showProductLogo())
702 QWidget * logoWidget =
new QWidget;
703 logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
704 logoWidget->setObjectName(
"LogoHBox");
705 vbox->addWidget( logoWidget );
707 QHBoxLayout * logoHBox =
new QHBoxLayout(logoWidget);
708 YUI_CHECK_NEW( logoHBox );
710 _dialogLogo =
new QLabel( _workArea );
711 YUI_CHECK_NEW( _dialogLogo );
712 logoHBox->addWidget( _dialogLogo );
713 _dialogLogo->setObjectName(
"DialogLogo" );
714 _dialogLogo->setAlignment( Qt::AlignLeft );
716 _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
717 _dialogLogo->setMinimumHeight(59);
718 _dialogLogo->setMinimumWidth(100);
719 logoHBox->addStretch();
726 _menuBar =
new QMenuBar( _workArea );
727 YUI_CHECK_NEW( _menuBar );
730 vbox->addWidget( _menuBar );
732 QWidget * dialog_inner_area =
new QWidget (_workArea);
733 dialog_inner_area->setObjectName(
"work_area" );
736 QVBoxLayout * inner_vbox =
new QVBoxLayout(dialog_inner_area);
737 YUI_CHECK_NEW( inner_vbox );
738 vbox->addWidget (dialog_inner_area);
740 QVBoxLayout *innerbox =
new QVBoxLayout( _workArea );
741 QVBoxLayout *leftInnerBox = innerbox;
742 QVBoxLayout *rightInnerBox = innerbox;
743 YUI_CHECK_NEW( innerbox );
745 innerbox->setMargin ( YQWidgetMargin );
747 inner_vbox->addLayout(innerbox);
748 vbox->setMargin( 0 );
755 if (titleIsOnTheLeft()) {
756 QHBoxLayout *bigHBox =
new QHBoxLayout();
757 innerbox->addLayout( bigHBox );
759 leftInnerBox =
new QVBoxLayout();
760 leftInnerBox->setObjectName(
"LeftInnerBox" );
761 bigHBox->addLayout( leftInnerBox );
762 bigHBox->setStretchFactor( leftInnerBox, 1 );
764 rightInnerBox =
new QVBoxLayout();
765 rightInnerBox->setObjectName(
"RightInnerBox" );
766 bigHBox->addLayout( rightInnerBox );
767 bigHBox->setStretchFactor( rightInnerBox, 2 );
770 QHBoxLayout * headingHBox =
new QHBoxLayout();
771 YUI_CHECK_NEW( headingHBox );
773 leftInnerBox->addLayout( headingHBox );
775 _dialogIcon =
new QLabel( _workArea );
776 YUI_CHECK_NEW( _dialogIcon );
777 headingHBox->addWidget( _dialogIcon );
778 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
779 _dialogIcon->setObjectName(
"DialogIcon" );
782 _dialogHeading =
new QLabel( _workArea );
783 YUI_CHECK_NEW( _dialogHeading );
784 headingHBox->addWidget( _dialogHeading );
785 _dialogHeading->setWordWrap(
true );
786 _dialogHeading->setTextFormat( Qt::PlainText );
787 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
788 _dialogHeading->setObjectName( (titleIsOnTheLeft())?
"DialogHeadingLeft" :
"DialogHeadingTop" ) ;
794 layoutClientArea( _workArea );
795 rightInnerBox->addWidget( _clientArea );
801 QLayout *bb = layoutButtonBox( _workArea );
802 innerbox->addLayout( bb );
809 void YQWizard::layoutClientArea( QWidget * parent )
811 _clientArea =
new QFrame( parent );
812 YUI_CHECK_NEW( _clientArea );
813 _clientArea->setObjectName(
"_clientArea");
814 QVBoxLayout *layout =
new QVBoxLayout( _clientArea );
815 layout->setMargin( 0 );
821 _contents =
new YQAlignment(
this, _clientArea, YAlignCenter, YAlignCenter );
822 YUI_CHECK_NEW( _contents );
823 layout->addWidget( _contents );
824 _contents->QObject::setProperty(
"class",
"Contents" );
826 _contents->setStretchable( YD_HORIZ,
true );
827 _contents->setStretchable( YD_VERT,
true );
828 _contents->installEventFilter(
this );
829 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
835 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
841 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
842 _contentsReplacePoint->showChild();
848 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
854 QHBoxLayout * hbox =
new QHBoxLayout();
855 YUI_CHECK_NEW( hbox );
857 hbox->setSpacing( 0 );
858 hbox->setMargin( 0 );
862 _helpButton =
new YQWizardButton(
this, parent, _(
"&Help" ).toStdString());
863 YUI_CHECK_NEW( _helpButton );
865 connect( _helpButton, &pclass(_helpButton)::clicked,
868 hbox->addWidget( (QWidget *) _helpButton->widgetRep() );
871 _helpAction =
new QAction(
this );
872 _helpAction->setShortcut( Qt::Key_F1 );
873 addAction( _helpAction );
875 connect( _helpAction, &pclass( _helpAction )::triggered,
879 _hotkeysAction =
new QAction(
this );
880 _hotkeysAction->setShortcut( Qt::ShiftModifier + Qt::Key_F1 );
881 addAction( _hotkeysAction );
883 connect( _hotkeysAction, &pclass( _hotkeysAction )::triggered,
886 hbox->addSpacing( 10 );
894 _releaseNotesButton =
new YQWizardButton(
this, parent, _(
"&Release Notes" ).toStdString ());
895 YUI_CHECK_NEW( _releaseNotesButton );
896 hbox->addWidget( (QWidget *) _releaseNotesButton->widgetRep() );
897 connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked,
901 if (_releaseNotesButtonId ==
"")
903 _releaseNotesButton->
hide();
910 hbox->addStretch( 10 );
916 _abortButton =
new YQWizardButton(
this, parent, _abortButtonLabel );
917 YUI_CHECK_NEW( _abortButton );
919 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
920 connect( _abortButton, &pclass(_abortButton)::clicked,
923 hbox->addSpacing( 10 );
929 _backButton =
new YQWizardButton(
this, parent, _backButtonLabel );
930 YUI_CHECK_NEW( _backButton );
932 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
933 connect( _backButton, &pclass(_backButton)::clicked,
936 if ( _backButton->
text().isEmpty() )
943 hbox->addSpacing( 5 );
945 _nextButton =
new YQWizardButton(
this, parent, _nextButtonLabel );
946 YUI_CHECK_NEW( _nextButton );
948 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
949 connect( _nextButton, &pclass(_nextButton)::clicked,
955 bool YQWizard::titleIsOnTheLeft()
957 return wizardMode() == YWizardMode_TitleOnLeft;
975 if ( QString( signal ).contains(
"nextClicked()" ) )
977 yuiDebug() <<
"nextClicked connected, no longer directly sending button events" << std::endl;
978 _sendButtonEvents =
false;
985 if ( QString( signal ).contains(
"nextClicked()" ) )
987 yuiDebug() <<
"nextClicked disconnected, directly sending button events again" << std::endl;
988 _sendButtonEvents =
true;
997 if ( ! iconName.empty() )
999 QPixmap icon( iconName.c_str() );
1001 if ( icon.isNull() )
1003 _dialogIcon->hide();
1004 yuiWarning() <<
"Couldn't load dialog icon \"" << iconName <<
"\"" << std::endl;
1008 _dialogIcon->show();
1009 _dialogIcon->setPixmap( icon );
1010 topLevelWidget()->setWindowIcon( icon );
1015 _dialogIcon->hide();
1016 _dialogIcon->clear();
1017 topLevelWidget()->setWindowIcon( QIcon() );
1025 QString title = fromUTF8( titleText.c_str() );
1027 if ( !title.isEmpty() )
1036 if ( _dialogHeading )
1038 if ( ! headingText.empty() )
1039 _dialogHeading->setText( fromUTF8( headingText ) );
1041 _dialogHeading->clear();
1047 if ( _dialogHeading )
1049 QString label = _dialogHeading->text();
1050 label = label.simplified();
1052 if ( ! label.isEmpty() )
1053 return toUTF8( label );
1056 return "untitled YQWizard";
1062 _qHelpText = fromUTF8( helpText );
1063 _qHelpText.replace(
"&product;", fromUTF8( YUI::app()->productName() ) );
1071 if ( _sendButtonEvents )
1074 _direction = YQWizard::Backward;
1082 if ( _sendButtonEvents )
1091 if ( _sendButtonEvents )
1094 _direction = YQWizard::Forward;
1104 _helpDlg->setHelpText( _qHelpText );
1110 _helpDlg->activateWindow();
1121 "<h1>Advanced Hotkeys</h1>" 1123 "<dt>Print Screen</dt>" 1124 "<dd>Take and save a screenshot. May not be available when YaST is running under " 1125 "some desktop environments.</dd>" 1127 "<dd>Enable/disable the color palette optimized for vision impaired users.</dd>" 1129 "<dd>Enable/disable logging of debug messages.</dd>" 1131 "<dd>Open a file dialog to save log files to a non-standard location.</dd>" 1132 "<dt>Ctrl-Shift-Alt-D</dt>" 1133 "<dd>Send a DebugEvent. YaST modules can react on this by executing " 1134 "special debugging actions. Result depends on the specific YaST-module.</dd>" 1135 "<dt>Ctrl-Shift-Alt-M</dt>" 1136 "<dd>Start/Stop macro recorder.</dd>" 1137 "<dt>Ctrl-Shift-Alt-P</dt>" 1138 "<dd>Replay macro.</dd>" 1139 "<dt>Ctrl-Shift-Alt-S</dt>" 1140 "<dd>Show style sheet editor.</dd>" 1141 "<dt>Ctrl-Shift-Alt-T</dt>" 1142 "<dd>Dump widget tree to the log file.</dd>" 1143 "<dt>Ctrl-Alt-Shift-X</dt>" 1144 "<dd>Open a terminal window (xterm). Useful for VNC installations.</dd>" 1145 "<dt>Ctrl-Shift-Alt-Y</dt>" 1146 "<dd>Show widget tree browser.</dd>" 1153 _hotkeysDlg->show();
1154 _hotkeysDlg->raise();
1155 _hotkeysDlg->activateWindow();
1165 _relNotesDlg->hide();
1168 std::map<std::string,std::string> relnotes = YUI::application()->releaseNotes();
1169 if ( relnotes.size() == 0)
1173 _relNotesDlg->setRelNotes( relnotes );
1174 _relNotesDlg->show();
1175 _relNotesDlg->raise();
1176 _relNotesDlg->activateWindow();
1182 if ( _sideBar && _stepsPanel )
1184 _sideBar->setCurrentWidget( _stepsPanel );
1191 if ( _sideBar && _treePanel )
1193 _sideBar->setCurrentWidget( _treePanel );
1199 const std::string &
id )
1203 QMenu * menu =
new QMenu( _menuBar );
1204 YUI_CHECK_NEW( menu );
1206 _menuIDs.insert( fromUTF8(
id ), menu );
1207 _menuBar->addMenu( menu );
1208 menu->setTitle( fromUTF8( text ) );
1210 connect( menu, &pclass(menu)::triggered,
1219 const std::string & text,
1220 const std::string &
id )
1222 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1226 QMenu * menu =
new QMenu( _menuBar );
1227 YUI_CHECK_NEW( menu );
1229 _menuIDs.insert( fromUTF8(
id ), menu );
1232 connect( menu, &pclass(menu)::triggered,
1237 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1243 const std::string & text,
1244 const std::string & idString )
1246 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1251 int id = _menuEntryIDs.size();
1254 action = parentMenu->addAction( fromUTF8( text ) );
1255 _menuEntryIDs[ action ] = idString ;
1260 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1267 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1271 parentMenu->addSeparator();
1275 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1287 _menuEntryIDs.clear();
1294 if ( _menuEntryIDs.contains( action ) )
1300 yuiError() <<
"Invalid menu ID " << std::endl;
1313 return sizeHint().width();
1319 return sizeHint().height();
1325 resize( newWidth, newHeight );
1331 QSize contentsRect = _clientArea->contentsRect().size();
1332 _contents->
setSize( contentsRect.width(), contentsRect.height() );
1337 if ( ev->type() == QEvent::Resize && obj == _contents )
1343 if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
1349 return QWidget::eventFilter( obj, ev );
1355 button->setLabel( newLabel );
1356 YDialog::currentDialog()->checkShortcuts();
1360 if ( wizardButton ) {
1362 if ( newLabel.empty() )
1363 wizardButton->
hide();
1365 wizardButton->
show();
1372 if ( ! _releaseNotesButton )
1374 yuiError() <<
"NULL Release Notes button" << std::endl;
1376 if ( ! _stepsPanel )
1377 yuiError() <<
"This works only if there is a \"steps\" panel!" << std::endl;
1383 _releaseNotesButton->
setLabel( fromUTF8( label ) );
1384 _releaseNotesButtonId = id;
1385 _releaseNotesButtonLabel = label;
1387 _releaseNotesButton->
show();
1393 if ( _releaseNotesButton && !_releaseNotesButton->
isHidden() )
1395 _releaseNotesButton->
hide();
1396 _releaseNotesButtonId =
"";
1397 _releaseNotesButtonLabel =
"";
1409 _helpButton->
setLabel( _(
"&Help" ) );
1414 _stepsButton->setText( _(
"&Steps" ) );
1419 _treeButton->setText( _(
"&Tree" ) );
1421 if ( _releaseNotesButton )
1424 _releaseNotesButton->
setLabel( _(
"&Release Notes" ) );
1427 _helpDlg->retranslate();
1430 _hotkeysDlg->retranslate();
1433 _relNotesDlg->retranslate();
1438 void YQWizard::Step::deleteLabels()
1440 delete _statusLabel;
1455 if ( !_statusLabel || !_nameLabel || _status == s )
1462 _statusLabel->setProperty(
"class",
"todo-step-status QLabel" );
1463 _nameLabel->setProperty (
"class",
"todo-step-name QLabel" );
1468 _statusLabel->setProperty(
"class",
"done-step-status QLabel" );
1469 _nameLabel->setProperty (
"class",
"done-step-name QLabel" );
1474 _statusLabel->setProperty(
"class",
"current-step-status QLabel" );
1475 _nameLabel->setProperty (
"class",
"current-step-name QLabel" );
1478 _statusLabel->style()->unpolish( _statusLabel );
1479 _statusLabel->style()->polish( _statusLabel );
1480 _nameLabel->style()->unpolish( _nameLabel );
1481 _nameLabel->style()->polish( _nameLabel );
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...
void registerWidget(QWidget *widget)
Registers a widget and applies the style sheet.
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 showHotkeys()
Show an overview of the power-user hotkeys.
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.
bool fullscreen() const
Return 'true' if defaultsize windows should use the full screen.
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.
void registerChildWidget(QWidget *parent, QWidget *widget)
Registers a child widget.
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.
void unregisterWidget(QWidget *widget)
Unregisters a 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.