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 string YQWizard::_releaseNotesButtonId =
"";
87 string YQWizard::_releaseNotesButtonLabel =
"";
90 const string & backButtonLabel,
91 const string & abortButtonLabel,
92 const 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;
144 _sendButtonEvents =
true;
145 _contentsReplacePoint = 0;
147 _previousWindowIcon = topLevelWidget()->windowIcon();
151 if( topLevelWidget()->windowTitle().isEmpty() )
154 QString icon_name = QFileInfo( YUI::app()->applicationIcon().c_str() ).baseName();
155 setWindowIcon ( QIcon::fromTheme( icon_name, QIcon( YUI::app()->applicationIcon().c_str() ) ) );
158 layout->addLayout( layoutSideBar(
this ) );
159 layout->addWidget( layoutWorkArea(
this ) );
161 setStretchFactor( indexOf( _sideBar ), 0 );
162 setStretchFactor( indexOf( _workArea ), 1 );
163 setCollapsible( indexOf( _sideBar ),
false );
167 if ( !_stepsEnabled )
174 else if ( main_wizard )
181 topLevelWidget()->activateWindow();
189 if (
this == main_wizard )
193 else if ( main_wizard )
196 main_wizard->setSizes( sizes() );
204 topLevelWidget()->setWindowIcon( _previousWindowIcon );
210 return this != main_wizard;
214 void YQWizard::layoutTitleBar( QWidget * parent )
216 QFrame * titleBar =
new QFrame( parent );
217 YUI_CHECK_NEW( titleBar );
219 QHBoxLayout *layout =
new QHBoxLayout( titleBar );
220 titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
226 QLabel * left =
new QLabel( titleBar );
227 layout->addWidget( left );
228 left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
229 left->setObjectName(
"titleBar-left" );
235 layout->addStretch( 10 );
242 QLabel * right =
new QLabel( titleBar );
243 YUI_CHECK_NEW( right );
245 layout->addWidget( right );
246 right->setObjectName(
"titleBar-right" );
250 QLayout *YQWizard::layoutSideBar( QWidget * parent )
252 _sideBar =
new QStackedWidget( parent );
253 YUI_CHECK_NEW( _sideBar );
255 _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
256 _sideBar->setObjectName( QString(
"_sideBar-%1" ).arg(
long(
this ) ) );
257 _sideBar->installEventFilter(
this );
259 QVBoxLayout *vbox =
new QVBoxLayout( );
260 vbox->addWidget( _sideBar );
267 else if ( _stepsEnabled )
279 void YQWizard::layoutStepsPanel()
282 _stepsPanel =
new QFrame( _sideBar );
283 _sideBar->addWidget( _stepsPanel );
284 _sideBar->setObjectName(
"steps" );
285 _sideBar->setProperty(
"class",
"steps" );
294 QString qId = fromUTF8(
id );
296 if ( _stepsIDs[ qId ] )
298 yuiError() <<
"Step ID \"" <<
id <<
"\" (\"" << text
299 <<
"\") already used for \"" << _stepsIDs[ qId ]->name() <<
"\"" 304 if ( !_stepsList.empty() && _stepsList.last()->name() == fromUTF8( text ) )
312 _stepsList.last()->addID( qId );
320 _stepsIDs.insert( qId, _stepsList.last() );
323 if ( _currentStepID.isNull() )
324 _currentStepID = qId;
340 yuiDebug() <<
"updateSteps" << endl;
342 if ( !_stepsRegistered )
343 setUpdatesEnabled(
false);
346 delete _stepsPanel->layout();
347 _stepsPanel->setMaximumWidth( 65000 );
349 QVBoxLayout *_stepsVBox =
new QVBoxLayout( _stepsPanel );
351 QGridLayout *_stepsGrid =
new QGridLayout( );
352 _stepsGrid->setObjectName( QString(
"_stepsGrid_%1" ).arg(
long(
this ) ) );
353 YUI_CHECK_NEW( _stepsGrid );
354 _stepsVBox->addLayout( _stepsGrid );
355 _stepsVBox->setMargin(0);
356 _stepsGrid->setSpacing(0);
358 const int statusCol = 1;
359 const int nameCol = 2;
367 for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
371 step->deleteLabels();
373 if ( step->isHeading() )
379 yuiDebug() <<
"Adding StepHeading \"" << step->name() <<
"\"" << endl;
380 QLabel * label =
new QLabel( step->name(), _stepsPanel );
381 YUI_CHECK_NEW( label );
382 label->setObjectName( step->name() );
383 label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
384 label->setProperty(
"class",
"steps_heading" );
386 step->setNameLabel( label );
387 _stepsGrid->addWidget( label,
389 1, nameCol - statusCol + 1);
397 yuiDebug() <<
"Adding Step \"" << step->name() <<
"\"" << endl;
399 QLabel * statusLabel =
new QLabel( _stepsPanel );
400 YUI_CHECK_NEW( statusLabel );
402 step->setStatusLabel( statusLabel );
403 statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
404 _stepsGrid->addWidget( statusLabel, row, statusCol );
410 QLabel * nameLabel =
new QLabel( step->name(), _stepsPanel );
411 YUI_CHECK_NEW( nameLabel );
412 nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
413 nameLabel->setObjectName( step->name() );
415 step->setNameLabel( nameLabel );
416 _stepsGrid->addWidget( nameLabel, row, nameCol );
423 _stepsVBox->addStretch( 99 );
424 QVBoxLayout *rbl =
new QVBoxLayout();
425 rbl->addWidget( (QWidget *) _releaseNotesButton->widgetRep(), 0, Qt::AlignCenter );
427 _stepsVBox->addLayout( rbl );
428 _stepsVBox->addStretch( 1 );
432 if ( !_stepsRegistered )
435 setUpdatesEnabled(
true );
436 QY2Styler::styler()->updateRendering(
this );
437 _stepsRegistered =
true;
444 yuiDebug() <<
"steps dirty: " << _stepsDirty << endl;
450 QList<YQWizard::Step*>::iterator step = _stepsList.begin();
461 while ( step != _stepsList.end() && *step !=
currentStep )
463 ( *step )->setStatus( Step::Done );
469 if ( step != _stepsList.end() )
477 while ( step != _stepsList.end() )
479 ( *step )->setStatus( Step::Todo );
487 yuiDebug() <<
"Setting current step to \"" <<
id <<
"\"" << endl;
489 _currentStepID = fromUTF8(
id );
495 QList<Step*> _oldSteps = wizard->
stepsList();
497 if (_oldSteps.empty())
500 foreach(
Step *oldStep, _oldSteps)
504 if( !oldStep->isHeading() )
505 newStep =
new Step( oldStep->name());
509 foreach( QString oneId, oldStep->id())
511 newStep->addID( oneId);
512 _stepsIDs.insert( oneId, newStep );
515 newStep->setEnabled( oldStep->isEnabled());
516 _stepsList.append(newStep);
521 setSizes( main_wizard->sizes());
527 yuiDebug() <<
"Deleting steps" << endl;
530 _stepsPanel->setFixedWidth( _stepsPanel->width() );
532 qDeleteAll(_stepsList);
535 _currentStepID = QString();
545 return _stepsIDs[ id ];
549 void YQWizard::layoutTreePanel()
551 _treePanel =
new QFrame( _sideBar );
552 YUI_CHECK_NEW( _treePanel );
553 QHBoxLayout *layout =
new QHBoxLayout( _treePanel );
554 _sideBar->addWidget( _treePanel );
556 QVBoxLayout * vbox =
new QVBoxLayout();
557 YUI_CHECK_NEW( vbox );
558 layout->addLayout( vbox );
563 YUI_CHECK_NEW( _tree );
564 vbox->addWidget( _tree );
566 _tree->header()->hide();
567 _tree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
569 _tree->setRootIsDecorated(
true );
572 connect( _tree, &pclass(_tree)::itemSelectionChanged,
575 connect( _tree, &pclass(_tree)::itemDoubleClicked,
583 QString qId = fromUTF8(
id );
587 yuiError() <<
"YQWizard widget not created with `opt(`treeEnabled) !" << endl;
594 if ( ! parentID.empty() )
602 YUI_CHECK_NEW( item );
607 YUI_CHECK_NEW( item );
610 if ( ! qId.isEmpty() )
611 _treeIDs.insert( qId, item );
631 return _treeIDs[ fromUTF8(
id ) ];
645 _tree->setCurrentItem(item);
646 _tree->scrollToItem(item);
658 if ( item && ! item->id().isEmpty() )
675 QTreeWidgetItem * sel = _tree->currentItem();
681 if ( item && ! item->id().isEmpty() )
682 return toUTF8( item->id() );
691 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
693 _workArea =
new QFrame( parent );
695 QVBoxLayout *vbox =
new QVBoxLayout( _workArea );
696 YUI_CHECK_NEW( vbox );
699 if (YUI::application()->showProductLogo())
701 QWidget * logoWidget =
new QWidget;
702 logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
703 logoWidget->setObjectName(
"LogoHBox");
704 vbox->addWidget( logoWidget );
706 QHBoxLayout * logoHBox =
new QHBoxLayout(logoWidget);
707 YUI_CHECK_NEW( logoHBox );
709 _dialogLogo =
new QLabel( _workArea );
710 YUI_CHECK_NEW( _dialogLogo );
711 logoHBox->addWidget( _dialogLogo );
712 _dialogLogo->setObjectName(
"DialogLogo" );
713 _dialogLogo->setAlignment( Qt::AlignLeft );
715 _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
716 _dialogLogo->setMinimumHeight(59);
717 _dialogLogo->setMinimumWidth(100);
719 logoHBox->addStretch();
721 _dialogBanner =
new QLabel( _workArea );
722 _dialogBanner->setText( QString( getenv(
"YAST_BANNER" ) ) );
723 YUI_CHECK_NEW( _dialogBanner );
724 logoHBox->addWidget( _dialogBanner );
725 _dialogBanner->setObjectName(
"DialogBanner" );
726 _dialogBanner->setAlignment( Qt::AlignCenter );
734 _menuBar =
new QMenuBar( _workArea );
735 YUI_CHECK_NEW( _menuBar );
738 vbox->addWidget( _menuBar );
740 QWidget * dialog_inner_area =
new QWidget (_workArea);
741 dialog_inner_area->setObjectName(
"work_area" );
744 QVBoxLayout * inner_vbox =
new QVBoxLayout(dialog_inner_area);
745 YUI_CHECK_NEW( inner_vbox );
746 vbox->addWidget (dialog_inner_area);
748 QVBoxLayout *innerbox =
new QVBoxLayout( _workArea );
749 QVBoxLayout *leftInnerBox = innerbox;
750 QVBoxLayout *rightInnerBox = innerbox;
751 YUI_CHECK_NEW( innerbox );
753 innerbox->setMargin ( YQWidgetMargin );
755 inner_vbox->addLayout(innerbox);
756 vbox->setMargin( 0 );
763 if (titleIsOnTheLeft()) {
764 QHBoxLayout *bigHBox =
new QHBoxLayout();
765 innerbox->addLayout( bigHBox );
767 leftInnerBox =
new QVBoxLayout();
768 leftInnerBox->setObjectName(
"LeftInnerBox" );
769 bigHBox->addLayout( leftInnerBox );
770 bigHBox->setStretchFactor( leftInnerBox, 1 );
772 rightInnerBox =
new QVBoxLayout();
773 rightInnerBox->setObjectName(
"RightInnerBox" );
774 bigHBox->addLayout( rightInnerBox );
775 bigHBox->setStretchFactor( rightInnerBox, 2 );
778 QHBoxLayout * headingHBox =
new QHBoxLayout();
779 YUI_CHECK_NEW( headingHBox );
781 leftInnerBox->addLayout( headingHBox );
783 _dialogIcon =
new QLabel( _workArea );
784 YUI_CHECK_NEW( _dialogIcon );
785 headingHBox->addWidget( _dialogIcon );
786 _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
787 _dialogIcon->setObjectName(
"DialogIcon" );
790 _dialogHeading =
new QLabel( _workArea );
791 YUI_CHECK_NEW( _dialogHeading );
792 headingHBox->addWidget( _dialogHeading );
793 _dialogHeading->setWordWrap(
true );
794 _dialogHeading->setTextFormat( Qt::PlainText );
795 _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
796 _dialogHeading->setObjectName( (titleIsOnTheLeft())?
"DialogHeadingLeft" :
"DialogHeadingTop" ) ;
802 layoutClientArea( _workArea );
803 rightInnerBox->addWidget( _clientArea );
809 QLayout *bb = layoutButtonBox( _workArea );
810 innerbox->addLayout( bb );
817 void YQWizard::layoutClientArea( QWidget * parent )
819 _clientArea =
new QFrame( parent );
820 YUI_CHECK_NEW( _clientArea );
821 _clientArea->setObjectName(
"_clientArea");
822 QVBoxLayout *layout =
new QVBoxLayout( _clientArea );
823 layout->setMargin( 0 );
829 _contents =
new YQAlignment(
this, _clientArea, YAlignCenter, YAlignCenter );
830 YUI_CHECK_NEW( _contents );
831 layout->addWidget( _contents );
832 _contents->QObject::setProperty(
"class",
"Contents" );
834 _contents->setStretchable( YD_HORIZ,
true );
835 _contents->setStretchable( YD_VERT,
true );
836 _contents->installEventFilter(
this );
837 _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
843 _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
849 YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
850 _contentsReplacePoint->showChild();
856 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
862 QHBoxLayout * hbox =
new QHBoxLayout();
863 YUI_CHECK_NEW( hbox );
865 hbox->setSpacing( 0 );
866 hbox->setMargin( 0 );
870 _helpButton =
new YQWizardButton(
this, parent, _(
"&Help" ).toStdString());
871 YUI_CHECK_NEW( _helpButton );
873 connect( _helpButton, &pclass(_helpButton)::clicked,
876 hbox->addWidget( (QWidget *) _helpButton->widgetRep() );
879 _helpAction =
new QAction(
this );
880 _helpAction->setShortcut( Qt::Key_F1 );
881 addAction( _helpAction );
883 connect( _helpAction, &pclass( _helpAction )::triggered,
887 _hotkeysAction =
new QAction(
this );
888 _hotkeysAction->setShortcut( Qt::ShiftModifier + Qt::Key_F1 );
889 addAction( _hotkeysAction );
891 connect( _hotkeysAction, &pclass( _hotkeysAction )::triggered,
894 hbox->addSpacing( 10 );
902 _releaseNotesButton =
new YQWizardButton(
this, parent, _(
"&Release Notes" ).toStdString ());
903 YUI_CHECK_NEW( _releaseNotesButton );
904 hbox->addWidget( (QWidget *) _releaseNotesButton->widgetRep() );
905 connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked,
909 if (_releaseNotesButtonId ==
"")
911 _releaseNotesButton->
hide();
918 hbox->addStretch( 10 );
924 _abortButton =
new YQWizardButton(
this, parent, _abortButtonLabel );
925 YUI_CHECK_NEW( _abortButton );
927 hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
928 connect( _abortButton, &pclass(_abortButton)::clicked,
931 hbox->addSpacing( 10 );
937 _backButton =
new YQWizardButton(
this, parent, _backButtonLabel );
938 YUI_CHECK_NEW( _backButton );
940 hbox->addWidget( (QWidget *) _backButton->widgetRep() );
941 connect( _backButton, &pclass(_backButton)::clicked,
944 if ( _backButton->
text().isEmpty() )
951 hbox->addSpacing( 5 );
953 _nextButton =
new YQWizardButton(
this, parent, _nextButtonLabel );
954 YUI_CHECK_NEW( _nextButton );
956 hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
957 connect( _nextButton, &pclass(_nextButton)::clicked,
963 bool YQWizard::titleIsOnTheLeft()
965 return wizardMode() == YWizardMode_TitleOnLeft;
983 if ( QString( signal ).contains(
"nextClicked()" ) )
985 yuiDebug() <<
"nextClicked connected, no longer directly sending button events" << endl;
986 _sendButtonEvents =
false;
993 if ( QString( signal ).contains(
"nextClicked()" ) )
995 yuiDebug() <<
"nextClicked disconnected, directly sending button events again" << endl;
996 _sendButtonEvents =
true;
1005 if ( ! iconName.empty() )
1007 QPixmap icon( iconName.c_str() );
1009 if ( icon.isNull() )
1011 _dialogIcon->hide();
1012 yuiWarning() <<
"Couldn't load dialog icon \"" << iconName <<
"\"" << endl;
1016 _dialogIcon->show();
1017 _dialogIcon->setPixmap( icon );
1018 topLevelWidget()->setWindowIcon( icon );
1023 _dialogIcon->hide();
1024 _dialogIcon->clear();
1025 topLevelWidget()->setWindowIcon( QIcon() );
1033 QString title = fromUTF8( titleText.c_str() );
1035 if ( !title.isEmpty() )
1043 return toUTF8(topLevelWidget()->windowTitle());
1048 if ( _dialogHeading )
1050 if ( ! headingText.empty() )
1051 _dialogHeading->setText( fromUTF8( headingText ) );
1053 _dialogHeading->clear();
1060 return toUTF8(_dialogHeading->text());
1067 if ( _dialogHeading )
1069 QString label = _dialogHeading->text();
1070 label = label.simplified();
1072 if ( ! label.isEmpty() )
1073 return toUTF8( label );
1076 return "untitled YQWizard";
1082 _qHelpText = fromUTF8( helpText );
1083 _qHelpText.replace(
"&product;", fromUTF8( YUI::app()->productName() ) );
1091 if ( _sendButtonEvents )
1094 _direction = YQWizard::Backward;
1102 if ( _sendButtonEvents )
1111 if ( _sendButtonEvents )
1114 _direction = YQWizard::Forward;
1124 _helpDlg->setHelpText( _qHelpText );
1130 _helpDlg->activateWindow();
1141 "<h1>Advanced Hotkeys</h1>" 1143 "<dt>Print Screen</dt>" 1144 "<dd>Take and save a screenshot. May not be available when YaST is running under " 1145 "some desktop environments.</dd>" 1147 "<dd>Enable/disable the color palette optimized for vision impaired users.</dd>" 1149 "<dd>Enable/disable logging of debug messages.</dd>" 1151 "<dd>Open a file dialog to save log files to a non-standard location.</dd>" 1152 "<dt>Ctrl-Shift-Alt-D</dt>" 1153 "<dd>Send a DebugEvent. YaST modules can react on this by executing " 1154 "special debugging actions. Result depends on the specific YaST-module.</dd>" 1155 "<dt>Ctrl-Shift-Alt-M</dt>" 1156 "<dd>Start/Stop macro recorder.</dd>" 1157 "<dt>Ctrl-Shift-Alt-P</dt>" 1158 "<dd>Replay macro.</dd>" 1159 "<dt>Ctrl-Shift-Alt-S</dt>" 1160 "<dd>Show style sheet editor.</dd>" 1161 "<dt>Ctrl-Shift-Alt-T</dt>" 1162 "<dd>Dump widget tree to the log file.</dd>" 1163 "<dt>Ctrl-Alt-Shift-X</dt>" 1164 "<dd>Open a terminal window (xterm). Useful for VNC installations.</dd>" 1165 "<dt>Ctrl-Shift-Alt-Y</dt>" 1166 "<dd>Show widget tree browser.</dd>" 1173 _hotkeysDlg->show();
1174 _hotkeysDlg->raise();
1175 _hotkeysDlg->activateWindow();
1185 _relNotesDlg->hide();
1188 std::map<string,string> relnotes = YUI::application()->releaseNotes();
1189 if ( relnotes.size() == 0)
1193 _relNotesDlg->setRelNotes( relnotes );
1194 _relNotesDlg->show();
1195 _relNotesDlg->raise();
1196 _relNotesDlg->activateWindow();
1202 if ( _sideBar && _stepsPanel )
1204 _sideBar->setCurrentWidget( _stepsPanel );
1211 if ( _sideBar && _treePanel )
1213 _sideBar->setCurrentWidget( _treePanel );
1223 QMenu * menu =
new QMenu( _menuBar );
1224 YUI_CHECK_NEW( menu );
1226 _menuIDs.insert( fromUTF8(
id ), menu );
1227 _menuBar->addMenu( menu );
1228 menu->setTitle( fromUTF8( text ) );
1230 connect( menu, &pclass(menu)::triggered,
1239 const string & text,
1242 QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1246 QMenu * menu =
new QMenu( _menuBar );
1247 YUI_CHECK_NEW( menu );
1249 _menuIDs.insert( fromUTF8(
id ), menu );
1252 connect( menu, &pclass(menu)::triggered,
1257 yuiError() <<
"Can't find menu with ID " << parentMenuID << endl;
1263 const string & text,
1264 const string & idString )
1266 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1271 int id = _menuEntryIDs.size();
1274 action = parentMenu->addAction( fromUTF8( text ) );
1275 _menuEntryIDs[ action ] = idString ;
1280 yuiError() <<
"Can't find menu with ID " << parentMenuID << endl;
1287 QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1291 parentMenu->addSeparator();
1295 yuiError() <<
"Can't find menu with ID " << parentMenuID << endl;
1307 _menuEntryIDs.clear();
1314 if ( _menuEntryIDs.contains( action ) )
1320 yuiError() <<
"Invalid menu ID " << endl;
1333 return sizeHint().width();
1339 return sizeHint().height();
1345 resize( newWidth, newHeight );
1351 QSize contentsRect = _clientArea->contentsRect().size();
1352 _contents->
setSize( contentsRect.width(), contentsRect.height() );
1357 if ( ev->type() == QEvent::Resize && obj == _contents )
1363 if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
1369 return QWidget::eventFilter( obj, ev );
1375 button->setLabel( newLabel );
1376 YDialog::currentDialog()->checkShortcuts();
1380 if ( wizardButton ) {
1382 if ( newLabel.empty() )
1383 wizardButton->
hide();
1385 wizardButton->
show();
1392 if ( ! _releaseNotesButton )
1394 yuiError() <<
"NULL Release Notes button" << endl;
1396 if ( ! _stepsPanel )
1397 yuiError() <<
"This works only if there is a \"steps\" panel!" << endl;
1403 _releaseNotesButton->
setLabel( fromUTF8( label ) );
1404 _releaseNotesButtonId = id;
1405 _releaseNotesButtonLabel = label;
1407 _releaseNotesButton->
show();
1413 if ( _releaseNotesButton && !_releaseNotesButton->
isHidden() )
1415 _releaseNotesButton->
hide();
1416 _releaseNotesButtonId =
"";
1417 _releaseNotesButtonLabel =
"";
1429 _helpButton->
setLabel( _(
"&Help" ) );
1434 _stepsButton->setText( _(
"&Steps" ) );
1439 _treeButton->setText( _(
"&Tree" ) );
1441 if ( _releaseNotesButton )
1444 _releaseNotesButton->
setLabel( _(
"&Release Notes" ) );
1447 _helpDlg->retranslate();
1450 _hotkeysDlg->retranslate();
1453 _relNotesDlg->retranslate();
1458 void YQWizard::Step::deleteLabels()
1460 delete _statusLabel;
1475 if ( !_statusLabel || !_nameLabel || _status == s )
1482 _statusLabel->setProperty(
"class",
"todo-step-status QLabel" );
1483 _nameLabel->setProperty (
"class",
"todo-step-name QLabel" );
1488 _statusLabel->setProperty(
"class",
"done-step-status QLabel" );
1489 _nameLabel->setProperty (
"class",
"done-step-name QLabel" );
1494 _statusLabel->setProperty(
"class",
"current-step-status QLabel" );
1495 _nameLabel->setProperty (
"class",
"current-step-name QLabel" );
1498 _statusLabel->style()->unpolish( _statusLabel );
1499 _statusLabel->style()->polish( _statusLabel );
1500 _nameLabel->style()->unpolish( _nameLabel );
1501 _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 std::string getDialogTitle()
Get the current dialog title shown in the window manager's title bar.
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.
virtual std::string getDialogHeading()
Get the dialog heading.
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.