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();
152 if( topLevelWidget()->windowTitle().isEmpty() )
155 QString icon_name = QFileInfo( YUI::app()->applicationIcon().c_str() ).baseName();
156 setWindowIcon ( QIcon::fromTheme( icon_name, QIcon( YUI::app()->applicationIcon().c_str() ) ) );
159 layout->addLayout( layoutSideBar(
this ) );
160 layout->addWidget( layoutWorkArea(
this ) );
162 setStretchFactor( indexOf( _sideBar ), 0 );
163 setStretchFactor( indexOf( _workArea ), 1 );
164 setCollapsible( indexOf( _sideBar ),
false );
168 if ( !_stepsEnabled )
175 else if ( main_wizard )
182 topLevelWidget()->activateWindow();
190 if (
this == main_wizard )
194 else if ( main_wizard )
197 main_wizard->setSizes( sizes() );
205 topLevelWidget()->setWindowIcon( _previousWindowIcon );
211 return this != main_wizard;
215 void YQWizard::layoutTitleBar( QWidget * parent )
217 QFrame * titleBar =
new QFrame( parent );
218 YUI_CHECK_NEW( titleBar );
220 QHBoxLayout *layout =
new QHBoxLayout( titleBar );
221 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
227 QLabel * left =
new QLabel( titleBar );
228 layout->addWidget( left );
229 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
230 left->setObjectName(
"titleBar-left" );
236 layout->addStretch( 10 );
243 QLabel * right =
new QLabel( titleBar );
244 YUI_CHECK_NEW( right );
246 layout->addWidget( right );
247 right->setObjectName(
"titleBar-right" );
251 QLayout *YQWizard::layoutSideBar( QWidget * parent )
253 _sideBar =
new QStackedWidget( parent );
254 YUI_CHECK_NEW( _sideBar );
256 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
257 _sideBar->setObjectName( QString(
"_sideBar-%1" ).arg(
long(
this ) ) );
258 _sideBar->installEventFilter(
this );
260 QVBoxLayout *vbox =
new QVBoxLayout( );
261 vbox->addWidget( _sideBar );
268 else if ( _stepsEnabled )
280 void YQWizard::layoutStepsPanel()
283 _stepsPanel =
new QFrame( _sideBar );
284 _sideBar->addWidget( _stepsPanel );
285 _sideBar->setObjectName(
"steps" );
286 _sideBar->setProperty(
"class",
"steps" );
295 QString qId = fromUTF8(
id );
297 if ( _stepsIDs[ qId ] )
299 yuiError() <<
"Step ID \"" <<
id <<
"\" (\"" << text
300 <<
"\") already used for \"" << _stepsIDs[ qId ]->name() <<
"\"" 305 if ( !_stepsList.empty() && _stepsList.last()->name() == fromUTF8( text ) )
313 _stepsList.last()->addID( qId );
321 _stepsIDs.insert( qId, _stepsList.last() );
324 if ( _currentStepID.isNull() )
325 _currentStepID = qId;
341 yuiDebug() <<
"updateSteps" << std::endl;
343 if ( !_stepsRegistered )
344 setUpdatesEnabled(
false);
347 delete _stepsPanel->layout();
348 _stepsPanel->setMaximumWidth( 65000 );
350 QVBoxLayout *_stepsVBox =
new QVBoxLayout( _stepsPanel );
352 QGridLayout *_stepsGrid =
new QGridLayout( );
353 _stepsGrid->setObjectName( QString(
"_stepsGrid_%1" ).arg(
long(
this ) ) );
354 YUI_CHECK_NEW( _stepsGrid );
355 _stepsVBox->addLayout( _stepsGrid );
356 _stepsGrid->setColumnMinimumWidth( 0, 10 );
357 _stepsGrid->setRowStretch( 0, 1 );
358 _stepsGrid->setRowStretch( 1, 1 );
359 _stepsGrid->setRowStretch( 2, 99 );
361 const int statusCol = 1;
362 const int nameCol = 2;
370 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
374 step->deleteLabels();
376 if ( step->isHeading() )
382 yuiDebug() <<
"Adding StepHeading \"" << step->name() <<
"\"" << std::endl;
383 QLabel * label =
new QLabel( step->name(), _stepsPanel );
384 YUI_CHECK_NEW( label );
385 label->setObjectName( step->name() );
386 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
387 label->setProperty(
"class",
"steps_heading" );
389 step->setNameLabel( label );
390 _stepsGrid->addWidget( label,
392 1, nameCol - statusCol + 1);
400 yuiDebug() <<
"Adding Step \"" << step->name() <<
"\"" << std::endl;
402 QLabel * statusLabel =
new QLabel( _stepsPanel );
403 YUI_CHECK_NEW( statusLabel );
405 step->setStatusLabel( statusLabel );
406 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
407 _stepsGrid->addWidget( statusLabel, row, statusCol );
413 QLabel * nameLabel =
new QLabel( step->name(), _stepsPanel );
414 YUI_CHECK_NEW( nameLabel );
415 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
416 nameLabel->setObjectName( step->name() );
418 step->setNameLabel( nameLabel );
419 _stepsGrid->addWidget( nameLabel, row, nameCol );
426 _stepsVBox->addStretch( 99 );
427 QVBoxLayout *rbl =
new QVBoxLayout();
428 rbl->addWidget( (QWidget *) _releaseNotesButton->widgetRep(), 0, Qt::AlignCenter );
430 _stepsVBox->addLayout( rbl );
431 _stepsVBox->addStretch( 1 );
435 if ( !_stepsRegistered )
438 setUpdatesEnabled(
true );
439 QY2Styler::styler()->updateRendering(
this );
440 _stepsRegistered =
true;
447 yuiDebug() <<
"steps dirty: " << _stepsDirty << std::endl;
453 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
464 while ( step != _stepsList.end() && *step !=
currentStep )
466 ( *step )->setStatus( Step::Done );
472 if ( step != _stepsList.end() )
480 while ( step != _stepsList.end() )
482 ( *step )->setStatus( Step::Todo );
490 yuiDebug() <<
"Setting current step to \"" <<
id <<
"\"" << std::endl;
492 _currentStepID = fromUTF8(
id );
498 QList<Step*> _oldSteps = wizard->
stepsList();
500 if (_oldSteps.empty())
503 foreach(
Step *oldStep, _oldSteps)
507 if( !oldStep->isHeading() )
508 newStep =
new Step( oldStep->name());
512 foreach( QString oneId, oldStep->id())
514 newStep->addID( oneId);
515 _stepsIDs.insert( oneId, newStep );
518 newStep->setEnabled( oldStep->isEnabled());
519 _stepsList.append(newStep);
524 setSizes( main_wizard->sizes());
530 yuiDebug() <<
"Deleting steps" << std::endl;
533 _stepsPanel->setFixedWidth( _stepsPanel->width() );
535 qDeleteAll(_stepsList);
538 _currentStepID = QString::null;
548 return _stepsIDs[ id ];
552 void YQWizard::layoutTreePanel()
554 _treePanel =
new QFrame( _sideBar );
555 YUI_CHECK_NEW( _treePanel );
556 QHBoxLayout *layout =
new QHBoxLayout( _treePanel );
557 _sideBar->addWidget( _treePanel );
559 QVBoxLayout * vbox =
new QVBoxLayout();
560 YUI_CHECK_NEW( vbox );
561 layout->addLayout( vbox );
566 YUI_CHECK_NEW( _tree );
567 vbox->addWidget( _tree );
569 _tree->header()->hide();
570 _tree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
572 _tree->setRootIsDecorated(
true );
575 connect( _tree, &pclass(_tree)::itemSelectionChanged,
578 connect( _tree, &pclass(_tree)::itemDoubleClicked,
586 QString qId = fromUTF8(
id );
590 yuiError() <<
"YQWizard widget not created with `opt(`treeEnabled) !" << std::endl;
597 if ( ! parentID.empty() )
605 YUI_CHECK_NEW( item );
610 YUI_CHECK_NEW( item );
613 if ( ! qId.isEmpty() )
614 _treeIDs.insert( qId, item );
634 return _treeIDs[ fromUTF8(
id ) ];
648 _tree->setCurrentItem(item);
649 _tree->scrollToItem(item);
661 if ( item && ! item->id().isEmpty() )
678 QTreeWidgetItem * sel = _tree->currentItem();
684 if ( item && ! item->id().isEmpty() )
685 return toUTF8( item->id() );
689 return std::string();
694 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
696 _workArea =
new QFrame( parent );
698 QVBoxLayout *vbox =
new QVBoxLayout( _workArea );
699 YUI_CHECK_NEW( vbox );
702 if (YUI::application()->showProductLogo())
704 QWidget * logoWidget =
new QWidget;
705 logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
706 logoWidget->setObjectName(
"LogoHBox");
707 vbox->addWidget( logoWidget );
709 QHBoxLayout * logoHBox =
new QHBoxLayout(logoWidget);
710 YUI_CHECK_NEW( logoHBox );
712 _dialogLogo =
new QLabel( _workArea );
713 YUI_CHECK_NEW( _dialogLogo );
714 logoHBox->addWidget( _dialogLogo );
715 _dialogLogo->setObjectName(
"DialogLogo" );
716 _dialogLogo->setAlignment( Qt::AlignLeft );
718 _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
719 _dialogLogo->setMinimumHeight(59);
720 _dialogLogo->setMinimumWidth(100);
721 logoHBox->addStretch();
728 _menuBar =
new QMenuBar( _workArea );
729 YUI_CHECK_NEW( _menuBar );
732 vbox->addWidget( _menuBar );
734 QWidget * dialog_inner_area =
new QWidget (_workArea);
735 dialog_inner_area->setObjectName(
"work_area" );
738 QVBoxLayout * inner_vbox =
new QVBoxLayout(dialog_inner_area);
739 YUI_CHECK_NEW( inner_vbox );
740 vbox->addWidget (dialog_inner_area);
742 QVBoxLayout *innerbox =
new QVBoxLayout( _workArea );
743 QVBoxLayout *leftInnerBox = innerbox;
744 QVBoxLayout *rightInnerBox = innerbox;
745 YUI_CHECK_NEW( innerbox );
747 innerbox->setMargin ( YQWidgetMargin );
749 inner_vbox->addLayout(innerbox);
750 vbox->setMargin( 0 );
757 if (titleIsOnTheLeft()) {
758 QHBoxLayout *bigHBox =
new QHBoxLayout();
759 innerbox->addLayout( bigHBox );
761 leftInnerBox =
new QVBoxLayout();
762 leftInnerBox->setObjectName(
"LeftInnerBox" );
763 bigHBox->addLayout( leftInnerBox );
764 bigHBox->setStretchFactor( leftInnerBox, 1 );
766 rightInnerBox =
new QVBoxLayout();
767 rightInnerBox->setObjectName(
"RightInnerBox" );
768 bigHBox->addLayout( rightInnerBox );
769 bigHBox->setStretchFactor( rightInnerBox, 2 );
772 QHBoxLayout * headingHBox =
new QHBoxLayout();
773 YUI_CHECK_NEW( headingHBox );
775 leftInnerBox->addLayout( headingHBox );
777 _dialogIcon =
new QLabel( _workArea );
778 YUI_CHECK_NEW( _dialogIcon );
779 headingHBox->addWidget( _dialogIcon );
780 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
781 _dialogIcon->setObjectName(
"DialogIcon" );
784 _dialogHeading =
new QLabel( _workArea );
785 YUI_CHECK_NEW( _dialogHeading );
786 headingHBox->addWidget( _dialogHeading );
787 _dialogHeading->setWordWrap(
true );
788 _dialogHeading->setTextFormat( Qt::PlainText );
789 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
790 _dialogHeading->setObjectName( (titleIsOnTheLeft())?
"DialogHeadingLeft" :
"DialogHeadingTop" ) ;
796 layoutClientArea( _workArea );
797 rightInnerBox->addWidget( _clientArea );
803 QLayout *bb = layoutButtonBox( _workArea );
804 innerbox->addLayout( bb );
811 void YQWizard::layoutClientArea( QWidget * parent )
813 _clientArea =
new QFrame( parent );
814 YUI_CHECK_NEW( _clientArea );
815 _clientArea->setObjectName(
"_clientArea");
816 QVBoxLayout *layout =
new QVBoxLayout( _clientArea );
817 layout->setMargin( 0 );
823 _contents =
new YQAlignment(
this, _clientArea, YAlignCenter, YAlignCenter );
824 YUI_CHECK_NEW( _contents );
825 layout->addWidget( _contents );
826 _contents->QObject::setProperty(
"class",
"Contents" );
828 _contents->setStretchable( YD_HORIZ,
true );
829 _contents->setStretchable( YD_VERT,
true );
830 _contents->installEventFilter(
this );
831 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
837 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
843 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
844 _contentsReplacePoint->showChild();
850 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
856 QHBoxLayout * hbox =
new QHBoxLayout();
857 YUI_CHECK_NEW( hbox );
859 hbox->setSpacing( 0 );
860 hbox->setMargin( 0 );
864 _helpButton =
new YQWizardButton(
this, parent, _(
"&Help" ).toStdString());
865 YUI_CHECK_NEW( _helpButton );
867 connect( _helpButton, &pclass(_helpButton)::clicked,
870 hbox->addWidget( (QWidget *) _helpButton->widgetRep() );
873 _helpAction =
new QAction(
this );
874 _helpAction->setShortcut( Qt::Key_F1 );
875 addAction( _helpAction );
877 connect( _helpAction, &pclass( _helpAction )::triggered,
881 _hotkeysAction =
new QAction(
this );
882 _hotkeysAction->setShortcut( Qt::ShiftModifier + Qt::Key_F1 );
883 addAction( _hotkeysAction );
885 connect( _hotkeysAction, &pclass( _hotkeysAction )::triggered,
888 hbox->addSpacing( 10 );
896 _releaseNotesButton =
new YQWizardButton(
this, parent, _(
"&Release Notes" ).toStdString ());
897 YUI_CHECK_NEW( _releaseNotesButton );
898 hbox->addWidget( (QWidget *) _releaseNotesButton->widgetRep() );
899 connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked,
903 if (_releaseNotesButtonId ==
"")
905 _releaseNotesButton->
hide();
912 hbox->addStretch( 10 );
918 _abortButton =
new YQWizardButton(
this, parent, _abortButtonLabel );
919 YUI_CHECK_NEW( _abortButton );
921 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
922 connect( _abortButton, &pclass(_abortButton)::clicked,
925 hbox->addSpacing( 10 );
931 _backButton =
new YQWizardButton(
this, parent, _backButtonLabel );
932 YUI_CHECK_NEW( _backButton );
934 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
935 connect( _backButton, &pclass(_backButton)::clicked,
938 if ( _backButton->
text().isEmpty() )
945 hbox->addSpacing( 5 );
947 _nextButton =
new YQWizardButton(
this, parent, _nextButtonLabel );
948 YUI_CHECK_NEW( _nextButton );
950 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
951 connect( _nextButton, &pclass(_nextButton)::clicked,
957 bool YQWizard::titleIsOnTheLeft()
959 return wizardMode() == YWizardMode_TitleOnLeft;
977 if ( QString( signal ).contains(
"nextClicked()" ) )
979 yuiDebug() <<
"nextClicked connected, no longer directly sending button events" << std::endl;
980 _sendButtonEvents =
false;
987 if ( QString( signal ).contains(
"nextClicked()" ) )
989 yuiDebug() <<
"nextClicked disconnected, directly sending button events again" << std::endl;
990 _sendButtonEvents =
true;
999 if ( ! iconName.empty() )
1001 QPixmap icon( iconName.c_str() );
1003 if ( icon.isNull() )
1005 _dialogIcon->hide();
1006 yuiWarning() <<
"Couldn't load dialog icon \"" << iconName <<
"\"" << std::endl;
1010 _dialogIcon->show();
1011 _dialogIcon->setPixmap( icon );
1012 topLevelWidget()->setWindowIcon( icon );
1017 _dialogIcon->hide();
1018 _dialogIcon->clear();
1019 topLevelWidget()->setWindowIcon( QIcon() );
1027 QString title = fromUTF8( titleText.c_str() );
1029 if ( !title.isEmpty() )
1038 if ( _dialogHeading )
1040 if ( ! headingText.empty() )
1041 _dialogHeading->setText( fromUTF8( headingText ) );
1043 _dialogHeading->clear();
1049 if ( _dialogHeading )
1051 QString label = _dialogHeading->text();
1052 label = label.simplified();
1054 if ( ! label.isEmpty() )
1055 return toUTF8( label );
1058 return "untitled YQWizard";
1064 _qHelpText = fromUTF8( helpText );
1065 _qHelpText.replace(
"&product;", fromUTF8( YUI::app()->productName() ) );
1073 if ( _sendButtonEvents )
1076 _direction = YQWizard::Backward;
1084 if ( _sendButtonEvents )
1093 if ( _sendButtonEvents )
1096 _direction = YQWizard::Forward;
1106 _helpDlg->setHelpText( _qHelpText );
1112 _helpDlg->activateWindow();
1123 "<h1>Advanced Hotkeys</h1>" 1125 "<dt>Print Screen</dt>" 1126 "<dd>Take and save a screenshot. May not be available when YaST is running under " 1127 "some desktop environments.</dd>" 1129 "<dd>Enable/disable the color palette optimized for vision impaired users.</dd>" 1131 "<dd>Enable/disable logging of debug messages.</dd>" 1133 "<dd>Open a file dialog to save log files to a non-standard location.</dd>" 1134 "<dt>Ctrl-Shift-Alt-D</dt>" 1135 "<dd>Send a DebugEvent. YaST modules can react on this by executing " 1136 "special debugging actions. Result depends on the specific YaST-module.</dd>" 1137 "<dt>Ctrl-Shift-Alt-M</dt>" 1138 "<dd>Start/Stop macro recorder.</dd>" 1139 "<dt>Ctrl-Shift-Alt-P</dt>" 1140 "<dd>Replay macro.</dd>" 1141 "<dt>Ctrl-Shift-Alt-S</dt>" 1142 "<dd>Show style sheet editor.</dd>" 1143 "<dt>Ctrl-Shift-Alt-T</dt>" 1144 "<dd>Dump widget tree to the log file.</dd>" 1145 "<dt>Ctrl-Alt-Shift-X</dt>" 1146 "<dd>Open a terminal window (xterm). Useful for VNC installations.</dd>" 1147 "<dt>Ctrl-Shift-Alt-Y</dt>" 1148 "<dd>Show widget tree browser.</dd>" 1155 _hotkeysDlg->show();
1156 _hotkeysDlg->raise();
1157 _hotkeysDlg->activateWindow();
1167 _relNotesDlg->hide();
1170 std::map<std::string,std::string> relnotes = YUI::application()->releaseNotes();
1171 if ( relnotes.size() == 0)
1175 _relNotesDlg->setRelNotes( relnotes );
1176 _relNotesDlg->show();
1177 _relNotesDlg->raise();
1178 _relNotesDlg->activateWindow();
1184 if ( _sideBar && _stepsPanel )
1186 _sideBar->setCurrentWidget( _stepsPanel );
1193 if ( _sideBar && _treePanel )
1195 _sideBar->setCurrentWidget( _treePanel );
1201 const std::string &
id )
1205 QMenu * menu =
new QMenu( _menuBar );
1206 YUI_CHECK_NEW( menu );
1208 _menuIDs.insert( fromUTF8(
id ), menu );
1209 _menuBar->addMenu( menu );
1210 menu->setTitle( fromUTF8( text ) );
1212 connect( menu, &pclass(menu)::triggered,
1221 const std::string & text,
1222 const std::string &
id )
1224 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1228 QMenu * menu =
new QMenu( _menuBar );
1229 YUI_CHECK_NEW( menu );
1231 _menuIDs.insert( fromUTF8(
id ), menu );
1234 connect( menu, &pclass(menu)::triggered,
1239 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1245 const std::string & text,
1246 const std::string & idString )
1248 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1253 int id = _menuEntryIDs.size();
1256 action = parentMenu->addAction( fromUTF8( text ) );
1257 _menuEntryIDs[ action ] = idString ;
1262 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1269 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1273 parentMenu->addSeparator();
1277 yuiError() <<
"Can't find menu with ID " << parentMenuID << std::endl;
1289 _menuEntryIDs.clear();
1296 if ( _menuEntryIDs.contains( action ) )
1302 yuiError() <<
"Invalid menu ID " << std::endl;
1315 return sizeHint().width();
1321 return sizeHint().height();
1327 resize( newWidth, newHeight );
1333 QSize contentsRect = _clientArea->contentsRect().size();
1334 _contents->
setSize( contentsRect.width(), contentsRect.height() );
1339 if ( ev->type() == QEvent::Resize && obj == _contents )
1345 if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
1351 return QWidget::eventFilter( obj, ev );
1357 button->setLabel( newLabel );
1358 YDialog::currentDialog()->checkShortcuts();
1360 YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (button);
1362 if ( wizardButton ) {
1364 if ( newLabel.empty() )
1365 wizardButton->
hide();
1367 wizardButton->
show();
1374 if ( ! _releaseNotesButton )
1376 yuiError() <<
"NULL Release Notes button" << std::endl;
1378 if ( ! _stepsPanel )
1379 yuiError() <<
"This works only if there is a \"steps\" panel!" << std::endl;
1385 _releaseNotesButton->
setLabel( fromUTF8( label ) );
1386 _releaseNotesButtonId = id;
1387 _releaseNotesButtonLabel = label;
1389 _releaseNotesButton->
show();
1395 if ( _releaseNotesButton && !_releaseNotesButton->
isHidden() )
1397 _releaseNotesButton->
hide();
1398 _releaseNotesButtonId =
"";
1399 _releaseNotesButtonLabel =
"";
1411 _helpButton->
setLabel( _(
"&Help" ) );
1416 _stepsButton->setText( _(
"&Steps" ) );
1421 _treeButton->setText( _(
"&Tree" ) );
1423 if ( _releaseNotesButton )
1426 _releaseNotesButton->
setLabel( _(
"&Release Notes" ) );
1429 _helpDlg->retranslate();
1432 _hotkeysDlg->retranslate();
1435 _relNotesDlg->retranslate();
1440 void YQWizard::Step::deleteLabels()
1442 delete _statusLabel;
1457 if ( !_statusLabel || !_nameLabel || _status == s )
1464 _statusLabel->setProperty(
"class",
"todo-step-status QLabel" );
1465 _nameLabel->setProperty (
"class",
"todo-step-name QLabel" );
1470 _statusLabel->setProperty(
"class",
"done-step-status QLabel" );
1471 _nameLabel->setProperty (
"class",
"done-step-name QLabel" );
1476 _statusLabel->setProperty(
"class",
"current-step-status QLabel" );
1477 _nameLabel->setProperty (
"class",
"current-step-name QLabel" );
1480 _statusLabel->style()->unpolish( _statusLabel );
1481 _statusLabel->style()->polish( _statusLabel );
1482 _nameLabel->style()->unpolish( _nameLabel );
1483 _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.