libyui-qt  2.46.13
YQWizard.cc
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YQWizard.cc
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23  Textdomain "qt"
24 
25 /-*/
26 
27 #include "YQWizard.h"
28 #define YUILogComponent "qt-wizard"
29 #include <yui/YUILog.h>
30 
31 #include <string>
32 #include <yui/YShortcut.h>
33 
34 #include <QDialog>
35 #include <QSvgRenderer>
36 #include <QPainter>
37 #include <QStackedWidget>
38 #include <qimage.h>
39 #include <qlabel.h>
40 #include <qlayout.h>
41 #include <qmenubar.h>
42 #include <qobject.h>
43 #include <qpixmap.h>
44 #include <qpushbutton.h>
45 #include <qregexp.h>
46 #include <qtabwidget.h>
47 #include <qtoolbutton.h>
48 #include <QGraphicsDropShadowEffect>
49 
50 #include "QY2ListView.h"
51 #include "QY2Styler.h"
52 #include "QY2HelpDialog.h"
53 #include <QGridLayout>
54 #include <QHeaderView>
55 #include <qevent.h>
56 
57 #include "utf8.h"
58 #include "YQi18n.h"
59 #include "YQUI.h"
60 #include "YQApplication.h"
61 #include "YQDialog.h"
62 #include "YQAlignment.h"
63 #include "YQReplacePoint.h"
64 #include "YQEmpty.h"
65 #include "YQLabel.h"
66 #include "YQWizardButton.h"
67 #include "YQWidgetFactory.h"
68 #include "YQSignalBlocker.h"
69 #include <yui/YEvent.h>
70 #include "YQMainWinDock.h"
71 
72 
73 using std::string;
74 
75 #ifdef TEXTDOMAIN
76 # undef TEXTDOMAIN
77 #endif
78 
79 #define TEXTDOMAIN "qt"
80 
81 #define USE_ICON_ON_HELP_BUTTON 0
82 
83 YQWizard *YQWizard::main_wizard = 0;
84 std::string YQWizard::_releaseNotesButtonId = "";
85 std::string YQWizard::_releaseNotesButtonLabel = "";
86 
87 YQWizard::YQWizard( YWidget * parent,
88  const std::string & backButtonLabel,
89  const std::string & abortButtonLabel,
90  const std::string & nextButtonLabel,
91  YWizardMode wizardMode )
92  : QSplitter( Qt::Horizontal, (QWidget *) parent->widgetRep() )
93 
94  , YWizard( parent,
95  backButtonLabel,
96  abortButtonLabel,
97  nextButtonLabel,
98  wizardMode )
99  , _backButtonLabel( backButtonLabel )
100  , _abortButtonLabel( abortButtonLabel )
101  , _nextButtonLabel( nextButtonLabel )
102  , _helpDlg ( NULL )
103 {
104  setObjectName( "wizard" );
105  setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
106 
107  QHBoxLayout* layout = new QHBoxLayout( this );
108  layout->setSpacing( 0 );
109  layout->setMargin( 0 );
110 
111  setWidgetRep( this );
112 
113  //either main wizard with `opt(`stepsEnabled), or sub-wizard of steps-enabled wizard
114  _stepsEnabled = ( (wizardMode == YWizardMode_Steps) || main_wizard );
115  _treeEnabled = (wizardMode == YWizardMode_Tree);
116 
117  _stepsRegistered = false;
118  _stepsDirty = false;
119  _direction = YQWizard::Forward;
120 
121  _sideBar = 0;
122  _stepsPanel = 0;
123  _helpButton = 0;
124  _stepsButton = 0;
125  _treeButton = 0;
126  _releaseNotesButton = 0;
127  _treePanel = 0;
128  _tree = 0;
129  _workArea = 0;
130  _clientArea = 0;
131  _menuBar = 0;
132  _dialogIcon = 0;
133  _dialogLogo = 0;
134  _dialogHeading = 0;
135  _contents = 0;
136  _backButton = 0;
137  _abortButton = 0;
138  _nextButton = 0;
139  _sendButtonEvents = true;
140  _contentsReplacePoint = 0;
141 
142  _previousWindowIcon = topLevelWidget()->windowIcon();
143 
144  YQUI::setTextdomain( TEXTDOMAIN );
145 
146  //layoutTitleBar( this );
147 
148  if( topLevelWidget()->windowTitle().isEmpty() )
149  {
150  topLevelWidget()->setWindowTitle ( YQUI::ui()->applicationTitle() );
151  QPixmap pixmap ( YUI::app()->applicationIcon().c_str() );
152  if ( !pixmap.isNull() )
153  setWindowIcon ( QIcon ( pixmap ) );
154  }
155 
156  layout->addLayout( layoutSideBar( this ) );
157  layout->addWidget( layoutWorkArea( this ) );
158 
159  setStretchFactor(indexOf(_sideBar),0);
160  setStretchFactor(indexOf(_workArea),1);
161 
162  /* If steps are enabled, we want to delay
163  the registering for after we have steps registered */
164  if ( !_stepsEnabled )
165  QY2Styler::styler()->registerWidget( this );
166 
167  if ( !main_wizard && _stepsEnabled )
168  {
169  main_wizard = this;
170  }
171  else if ( main_wizard )
172  {
173  copySteps( main_wizard );
175  }
176 
177 }
178 
179 
181 {
182  deleteSteps();
183  if ( this == main_wizard )
184  {
185  main_wizard = 0;
186  }
187  else if ( main_wizard )
188  {
189  //transfer the widget ratio to the main wizard
190  main_wizard->setSizes( sizes() );
191  }
192 
193  delete _helpDlg;
194 
195  QY2Styler::styler()->unregisterWidget( this );
196  topLevelWidget()->setWindowIcon( _previousWindowIcon );
197 }
198 
199 
201 {
202  return this != main_wizard;
203 }
204 
205 
206 void YQWizard::layoutTitleBar( QWidget * parent )
207 {
208  QFrame * titleBar = new QFrame( parent );
209  YUI_CHECK_NEW( titleBar );
210 
211  QHBoxLayout *layout = new QHBoxLayout( titleBar );
212  titleBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert
213 
214  //
215  // Left logo
216  //
217 
218  QLabel * left = new QLabel( titleBar );
219  layout->addWidget( left );
220  left->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
221  left->setObjectName( "titleBar-left" );
222 
223  //
224  // Center stretch space
225  //
226 
227  layout->addStretch( 10 );
228 
229 
230  //
231  // Right logo
232  //
233 
234  QLabel * right = new QLabel( titleBar );
235  YUI_CHECK_NEW( right );
236 
237  layout->addWidget( right );
238  right->setObjectName( "titleBar-right" );
239 }
240 
241 
242 QLayout *YQWizard::layoutSideBar( QWidget * parent )
243 {
244  _sideBar = new QStackedWidget( parent );
245  YUI_CHECK_NEW( _sideBar );
246  // _sideBar->setMinimumWidth( YQUI::ui()->defaultSize( YD_HORIZ ) / 5 );
247  _sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) ); // hor/vert
248  _sideBar->setObjectName( QString( "_sideBar-%1" ).arg( long( this ) ) );
249  _sideBar->installEventFilter( this );
250 
251  QVBoxLayout *vbox = new QVBoxLayout( );
252  vbox->addWidget( _sideBar );
253 
254  if ( _treeEnabled )
255  {
256  layoutTreePanel();
257  showTree();
258  }
259  else if ( _stepsEnabled )
260  {
261  layoutStepsPanel();
262  showSteps();
263  } else {
264  _sideBar->hide();
265  }
266 
267  return vbox;
268 }
269 
270 
271 void YQWizard::layoutStepsPanel()
272 {
273  // Steps
274  _stepsPanel = new QFrame( _sideBar );
275  _sideBar->addWidget( _stepsPanel );
276  _stepsPanel->setObjectName( "steps" );
277  QY2Styler::styler()->registerChildWidget( this, _stepsPanel );
278  _stepsPanel->setProperty( "class", "steps QFrame" );
279 
280  _stepsDirty = true; // no layout yet
281 }
282 
283 
284 void YQWizard::addStep( const std::string & text, const std::string & id )
285 {
286  QString qId = fromUTF8( id );
287 
288  if ( _stepsIDs[ qId ] )
289  {
290  yuiError() << "Step ID \"" << id << "\" (\"" << text
291  <<"\") already used for \"" << _stepsIDs[ qId ]->name() <<"\""
292  << std::endl;
293  return;
294  }
295 
296  if ( !_stepsList.empty() && _stepsList.last()->name() == fromUTF8( text ) )
297  {
298  // Consecutive steps with the same name will be shown as one single step.
299  //
300  // Since steps are always added at the end of the list, it is
301  // sufficient to check the last step of the list. If the texts are the
302  // same, the other with the same text needs to get another (additional)
303  // ID to make sure setCurrentStep() works as it should.
304  _stepsList.last()->addID( qId );
305  }
306  else
307  {
308  _stepsList.append( new YQWizard::Step( fromUTF8( text ), qId ) );
309  _stepsDirty = true;
310  }
311 
312  _stepsIDs.insert( qId, _stepsList.last() );
313 
314  // make sure we always have a current step if we have steps
315  if ( _currentStepID.isNull() )
316  _currentStepID = qId;
317 }
318 
319 
320 void YQWizard::addStepHeading( const std::string & text )
321 {
322  _stepsList.append( new YQWizard::StepHeading( fromUTF8( text ) ) );
323  _stepsDirty = true;
324 }
325 
326 
328 {
329  if ( ! _stepsPanel )
330  return;
331 
332  yuiDebug() << "updateSteps" << std::endl;
333 
334  if ( !_stepsRegistered )
335  setUpdatesEnabled(false);
336 
337  // Create a grid layout for the steps
338  delete _stepsPanel->layout();
339  _stepsPanel->setMaximumWidth( 65000 );
340 
341  QVBoxLayout *_stepsVBox = new QVBoxLayout( _stepsPanel );
342 
343  QGridLayout *_stepsGrid = new QGridLayout( );
344  _stepsGrid->setObjectName( QString( "_stepsGrid_%1" ).arg( long( this ) ) );
345  YUI_CHECK_NEW( _stepsGrid );
346  _stepsVBox->addLayout( _stepsGrid );
347  _stepsGrid->setColumnMinimumWidth( 0, 10 );
348  _stepsGrid->setRowStretch( 0, 1 );
349  _stepsGrid->setRowStretch( 1, 1 );
350  _stepsGrid->setRowStretch( 2, 99 );
351 
352  const int statusCol = 1;
353  const int nameCol = 2;
354 
355  int row = 0;
356 
357  //
358  // Create widgets for all steps and step headings in the internal list
359  //
360 
361  for ( QList<Step*>::iterator i = _stepsList.begin(); i != _stepsList.end(); ++i)
362  {
363  YQWizard::Step * step = *i;
364 
365  step->deleteLabels();
366 
367  if ( step->isHeading() )
368  {
369  //
370  // Heading
371  //
372 
373  yuiDebug() << "Adding StepHeading \"" << step->name() << "\"" << std::endl;
374  QLabel * label = new QLabel( step->name(), _stepsPanel );
375  YUI_CHECK_NEW( label );
376  label->setObjectName( step->name() );
377  label->setAlignment( Qt::AlignLeft | Qt::AlignTop );
378  label->setProperty( "class", "steps_heading" );
379 
380  step->setNameLabel( label );
381  _stepsGrid->addWidget( label,
382  row, statusCol,
383  1, nameCol - statusCol + 1);
384  }
385  else // No heading - ordinary step
386  {
387  //
388  // Step status
389  //
390 
391  yuiDebug() << "Adding Step \"" << step->name() << "\"" << std::endl;
392 
393  QLabel * statusLabel = new QLabel( _stepsPanel );
394  YUI_CHECK_NEW( statusLabel );
395 
396  step->setStatusLabel( statusLabel );
397  statusLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
398  _stepsGrid->addWidget( statusLabel, row, statusCol );
399 
400  //
401  // Step name
402  //
403 
404  QLabel * nameLabel = new QLabel( step->name(), _stepsPanel );
405  YUI_CHECK_NEW( nameLabel );
406  nameLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
407  nameLabel->setObjectName( step->name() );
408 
409  step->setNameLabel( nameLabel );
410  _stepsGrid->addWidget( nameLabel, row, nameCol );
411  }
412 
413  step->setStatus( Step::Todo );
414  row++;
415  }
416 
417  _stepsVBox->addStretch( 99 );
418  QVBoxLayout *rbl = new QVBoxLayout();
419  rbl->addWidget( _releaseNotesButton, 0, Qt::AlignCenter );
420 
421  _stepsVBox->addLayout( rbl );
422  _stepsVBox->addStretch( 29 );
423 
424  _stepsDirty = false;
425 
426  if ( !_stepsRegistered )
427  {
428  QY2Styler::styler()->registerWidget( this );
429  setUpdatesEnabled( true );
430  QY2Styler::styler()->updateRendering( this );
431  _stepsRegistered = true;
432  }
433 }
434 
435 
437 {
438  yuiDebug() << "steps dirty: " << _stepsDirty << std::endl;
439 
440  if ( _stepsDirty )
441  updateSteps();
442 
443  YQWizard::Step * currentStep = findStep( _currentStepID );
444  QList<YQWizard::Step*>::iterator step = _stepsList.begin();
445 
446  if ( currentStep )
447  {
448  // Set status icon and color for the current step
449  currentStep->setStatus( Step::Current );
450 
451  //
452  // Set all steps before the current to "done"
453  //
454 
455  while ( step != _stepsList.end() && *step != currentStep )
456  {
457  ( *step )->setStatus( Step::Done );
458  step++;
459  }
460 
461  // Skip the current step - continue with the step after it
462 
463  if ( step != _stepsList.end() )
464  step++;
465  }
466 
467  //
468  // Set all steps after the current to "to do"
469  //
470 
471  while ( step != _stepsList.end() )
472  {
473  ( *step )->setStatus( Step::Todo );
474  step++;
475  }
476 }
477 
478 
479 void YQWizard::setCurrentStep( const std::string & id )
480 {
481  yuiDebug() << "Setting current step to \"" << id << "\"" << std::endl;
482 
483  _currentStepID = fromUTF8( id );
485 }
486 
488 {
489  QList<Step*> _oldSteps = wizard->stepsList();
490 
491  if (_oldSteps.empty())
492  return;
493 
494  foreach( Step *oldStep, _oldSteps)
495  {
496  Step *newStep;
497 
498  if( !oldStep->isHeading() )
499  newStep = new Step( oldStep->name());
500  else
501  newStep = new StepHeading( oldStep->name());
502 
503  foreach( QString oneId, oldStep->id())
504  {
505  newStep->addID( oneId);
506  _stepsIDs.insert( oneId, newStep );
507  }
508 
509  newStep->setEnabled( oldStep->isEnabled());
510  _stepsList.append(newStep);
511 
512  }
513 
514  setCurrentStep( wizard->currentStep().toStdString() );
515  setSizes( main_wizard->sizes());
516 }
517 
518 
520 {
521  yuiDebug() << "Deleting steps" << std::endl;
522 
523  if ( _stepsPanel )
524  _stepsPanel->setFixedWidth( _stepsPanel->width() );
525 
526  qDeleteAll(_stepsList);
527  _stepsList.clear();
528  _stepsIDs.clear();
529  _currentStepID = QString::null;
530  _stepsDirty = true;
531 }
532 
533 
534 YQWizard::Step * YQWizard::findStep( const QString & id )
535 {
536  if ( id.isEmpty() )
537  return 0;
538 
539  return _stepsIDs[ id ];
540 }
541 
542 
543 void YQWizard::layoutTreePanel()
544 {
545  _treePanel = new QFrame( _sideBar );
546  YUI_CHECK_NEW( _treePanel );
547  QHBoxLayout *layout = new QHBoxLayout( _treePanel );
548  _sideBar->addWidget( _treePanel );
549 
550  QVBoxLayout * vbox = new QVBoxLayout();
551  YUI_CHECK_NEW( vbox );
552  layout->addLayout( vbox );
553 
554  // Selection tree
555 
556  _tree = new QY2ListView( _treePanel );
557  YUI_CHECK_NEW( _tree );
558  vbox->addWidget( _tree );
559 
560  _tree->header()->hide();
561  _tree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
562 
563  _tree->setRootIsDecorated( true );
564  _tree->setSortByInsertionSequence( true );
565 
566  connect( _tree, &pclass(_tree)::itemSelectionChanged,
567  this, &pclass(this)::treeSelectionChanged );
568 
569  connect( _tree, &pclass(_tree)::itemDoubleClicked,
570  this, &pclass(this)::sendTreeEvent );
571 
572 }
573 
574 
575 void YQWizard::addTreeItem( const std::string & parentID, const std::string & text, const std::string & id )
576 {
577  QString qId = fromUTF8( id );
578 
579  if ( ! _tree )
580  {
581  yuiError() << "YQWizard widget not created with `opt(`treeEnabled) !" << std::endl;
582  return;
583  }
584 
585  YQWizard::TreeItem * item = 0;
586  YQWizard::TreeItem * parent = 0;
587 
588  if ( ! parentID.empty() )
589  {
590  parent = findTreeItem( parentID );
591  }
592 
593  if ( parent )
594  {
595  item = new YQWizard::TreeItem( parent, fromUTF8( text ), qId );
596  YUI_CHECK_NEW( item );
597  }
598  else
599  {
600  item = new YQWizard::TreeItem( _tree, fromUTF8( text ), qId );
601  YUI_CHECK_NEW( item );
602  }
603 
604  if ( ! qId.isEmpty() )
605  _treeIDs.insert( qId, item );
606 }
607 
608 
609 
611 {
612  if ( _tree )
613  _tree->clear();
614 
615  _treeIDs.clear();
616 }
617 
618 
619 
620 YQWizard::TreeItem * YQWizard::findTreeItem( const std::string & id )
621 {
622  if ( id.empty() )
623  return 0;
624 
625  return _treeIDs[ fromUTF8( id ) ];
626 }
627 
628 
629 void YQWizard::selectTreeItem( const std::string & id )
630 {
631  if ( _tree )
632  {
633  YQWizard::TreeItem * item = findTreeItem( id );
634 
635  if ( item )
636  {
637  YQSignalBlocker sigBlocker( _tree );
638 
639  _tree->setCurrentItem(item);
640  _tree->scrollToItem(item);
641  }
642  }
643 }
644 
645 
646 void YQWizard::sendTreeEvent( QTreeWidgetItem * listViewItem )
647 {
648  if ( listViewItem )
649  {
650  YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> ( listViewItem );
651 
652  if ( item && ! item->id().isEmpty() )
653  sendEvent( toUTF8( item->id() ) );
654  }
655 }
656 
657 
659 { //FIXME is currentItem correct or selected.first
660  if ( _tree )
661  sendTreeEvent( _tree->currentItem() );
662 }
663 
664 
666 {
667  if ( _tree )
668  {
669  QTreeWidgetItem * sel = _tree->currentItem();
670 
671  if ( sel )
672  {
673  YQWizard::TreeItem * item = dynamic_cast<YQWizard::TreeItem *> (sel);
674 
675  if ( item && ! item->id().isEmpty() )
676  return toUTF8( item->id() );
677  }
678  }
679 
680  return std::string();
681 }
682 
683 
684 
685 QWidget *YQWizard::layoutWorkArea( QWidget * parent )
686 {
687  _workArea = new QFrame( parent );
688 
689  QVBoxLayout *vbox = new QVBoxLayout( _workArea );
690  YUI_CHECK_NEW( vbox );
691 
692  // add the logo on the top
693  if (YUI::application()->showProductLogo())
694  {
695  QWidget * logoWidget = new QWidget;
696  logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert
697  logoWidget->setObjectName("LogoHBox");
698  vbox->addWidget( logoWidget );
699 
700  QHBoxLayout * logoHBox = new QHBoxLayout(logoWidget);
701  YUI_CHECK_NEW( logoHBox );
702 
703  _dialogLogo = new QLabel( _workArea );
704  YUI_CHECK_NEW( _dialogLogo );
705  logoHBox->addWidget( _dialogLogo );
706  _dialogLogo->setObjectName( "DialogLogo" );
707  _dialogLogo->setAlignment( Qt::AlignLeft );
708  QY2Styler::styler()->registerChildWidget( this, _dialogLogo );
709  _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
710  _dialogLogo->setMinimumHeight(59); // FIXME: control size via stylesheet, did not find how
711  _dialogLogo->setMinimumWidth(100);
712  logoHBox->addStretch();
713  }
714 
715  //
716  // Menu bar
717  //
718 
719  _menuBar = new QMenuBar( _workArea );
720  YUI_CHECK_NEW( _menuBar );
721 
722  _menuBar->hide(); // will be made visible when menus are added
723  vbox->addWidget( _menuBar );
724 
725  QWidget * dialog_inner_area = new QWidget (_workArea);
726  dialog_inner_area->setObjectName( "work_area" );
727 
728  QY2Styler::styler()->registerChildWidget( this, dialog_inner_area );
729  QVBoxLayout * inner_vbox = new QVBoxLayout(dialog_inner_area);
730  YUI_CHECK_NEW( inner_vbox );
731  vbox->addWidget (dialog_inner_area);
732 
733  QVBoxLayout *innerbox = new QVBoxLayout( _workArea );
734  QVBoxLayout *leftInnerBox = innerbox;
735  QVBoxLayout *rightInnerBox = innerbox;
736  YUI_CHECK_NEW( innerbox );
737 
738  innerbox->setMargin ( YQWidgetMargin );
739 
740  inner_vbox->addLayout(innerbox);
741  vbox->setMargin( 0 );
742 
743 
744  //
745  // Dialog icon and heading
746  //
747 
748  if (titleIsOnTheLeft()) {
749  QHBoxLayout *bigHBox = new QHBoxLayout();
750  innerbox->addLayout( bigHBox );
751 
752  leftInnerBox = new QVBoxLayout();
753  leftInnerBox->setObjectName( "LeftInnerBox" );
754  bigHBox->addLayout( leftInnerBox );
755  bigHBox->setStretchFactor( leftInnerBox, 1 );
756 
757  rightInnerBox = new QVBoxLayout();
758  rightInnerBox->setObjectName( "RightInnerBox" );
759  bigHBox->addLayout( rightInnerBox );
760  bigHBox->setStretchFactor( rightInnerBox, 2 );
761  }
762 
763  QHBoxLayout * headingHBox = new QHBoxLayout();
764  YUI_CHECK_NEW( headingHBox );
765  //headingHBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
766  leftInnerBox->addLayout( headingHBox );
767 
768  _dialogIcon = new QLabel( _workArea );
769  YUI_CHECK_NEW( _dialogIcon );
770  headingHBox->addWidget( _dialogIcon );
771  _dialogIcon->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); // hor/vert
772  _dialogIcon->setObjectName( "DialogIcon" );
773 
774  _dialogHeading = new QLabel( _workArea );
775  YUI_CHECK_NEW( _dialogHeading );
776  headingHBox->addWidget( _dialogHeading );
777  _dialogHeading->setWordWrap( true );
778  _dialogHeading->setTextFormat( Qt::PlainText );
779  _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
780  _dialogHeading->setObjectName( (titleIsOnTheLeft())? "DialogHeadingLeft" : "DialogHeadingTop" ) ;
781 
782  //
783  // Client area (the part that belongs to the YCP application)
784  //
785 
786  layoutClientArea( _workArea );
787  rightInnerBox->addWidget( _clientArea );
788 
789  //
790  // Button box
791  //
792 
793  QLayout *bb = layoutButtonBox( _workArea );
794  innerbox->addLayout( bb );
795 
796  return _workArea;
797 }
798 
799 
800 
801 void YQWizard::layoutClientArea( QWidget * parent )
802 {
803  _clientArea = new QFrame( parent );
804  YUI_CHECK_NEW( _clientArea );
805  _clientArea->setObjectName("_clientArea");
806  QVBoxLayout *layout = new QVBoxLayout( _clientArea );
807  layout->setMargin( 0 );
808 
809  //
810  // HVCenter for wizard contents
811  //
812 
813  _contents = new YQAlignment( this, _clientArea, YAlignCenter, YAlignCenter );
814  YUI_CHECK_NEW( _contents );
815  layout->addWidget( _contents );
816  _contents->QObject::setProperty( "class", "Contents" );
817 
818  _contents->setStretchable( YD_HORIZ, true );
819  _contents->setStretchable( YD_VERT, true );
820  _contents->installEventFilter( this );
821  _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // hor/vert
822 
823  //
824  // Replace point for wizard contents
825  //
826 
827  _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( _contents );
828 
829  //
830  // Initial YEmpty widget contents of replace point
831  //
832 
833  YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
834  _contentsReplacePoint->showChild();
835 
836 }
837 
838 
839 
840 QLayout *YQWizard::layoutButtonBox( QWidget * parent )
841 {
842  //
843  // QHBoxLayout for the buttons
844  //
845 
846  QHBoxLayout * hbox = new QHBoxLayout(); // parent, spacing
847  YUI_CHECK_NEW( hbox );
848 
849  hbox->setSpacing( 0 );
850  hbox->setMargin( 0 );
851 
852  // Help button - intentionally without keyboard shortcut
853  _helpButton = new QPushButton( _( "Help" ), parent );
854  YUI_CHECK_NEW( _helpButton );
855  _helpButton->setShortcut( Qt::Key_F1 );
856 
857  connect( _helpButton, &pclass(_helpButton)::clicked,
858  this, &pclass(this)::showHelp );
859 
860  hbox->addWidget( _helpButton );
861 
862  hbox->addSpacing( 10 );
863 
864  //
865  // "Release Notes" button
866  //
867 
868  // Help button - intentionally without keyboard shortcut
869  _releaseNotesButton = new QPushButton( _( "Release Notes" ), parent );
870  YUI_CHECK_NEW( _releaseNotesButton );
871  hbox->addWidget( _releaseNotesButton );
872  connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked,
873  this, &pclass(this)::showReleaseNotes );
874 
875 
876  if (_releaseNotesButtonId == "")
877  {
878  _releaseNotesButton->hide(); // hidden until showReleaseNotesButton() is called
879  }
880  else
881  {
882  showReleaseNotesButton( _releaseNotesButtonLabel, _releaseNotesButtonId );
883  }
884 
885  hbox->addStretch( 10 );
886 
887  //
888  // "Abort" button
889  //
890 
891  _abortButton = new YQWizardButton( this, parent, _abortButtonLabel );
892  YUI_CHECK_NEW( _abortButton );
893 
894  hbox->addWidget( (QWidget *) _abortButton->widgetRep() );
895  connect( _abortButton, &pclass(_abortButton)::clicked,
896  this, &pclass(this)::slotAbortClicked );
897 
898  hbox->addSpacing( 10 );
899 
900  //
901  // "Back" button
902  //
903 
904  _backButton = new YQWizardButton( this, parent, _backButtonLabel );
905  YUI_CHECK_NEW( _backButton );
906 
907  hbox->addWidget( (QWidget *) _backButton->widgetRep() );
908  connect( _backButton, &pclass(_backButton)::clicked,
909  this, &pclass(this)::slotBackClicked );
910 
911  if ( _backButton->text().isEmpty() )
912  _backButton->hide();
913 
914  //
915  // "Next" button
916  //
917 
918  hbox->addSpacing( 5 );
919 
920  _nextButton = new YQWizardButton( this, parent, _nextButtonLabel );
921  YUI_CHECK_NEW( _nextButton );
922 
923  hbox->addWidget( (QWidget *) _nextButton->widgetRep() );
924  connect( _nextButton, &pclass(_nextButton)::clicked,
925  this, &pclass(this)::slotNextClicked );
926 
927  return hbox;
928 }
929 
930 bool YQWizard::titleIsOnTheLeft()
931 {
932  return wizardMode() == YWizardMode_TitleOnLeft;
933 }
934 
936 {
937  delete _backButton;
938  _backButton = 0;
939 
940  delete _abortButton;
941  _abortButton = 0;
942 
943  delete _nextButton;
944  _nextButton = 0;
945 }
946 
947 
948 void YQWizard::connectNotify ( const char * signal )
949 {
950  if ( QString( signal ).contains( "nextClicked()" ) )
951  {
952  yuiDebug() << "nextClicked connected, no longer directly sending button events" << std::endl;
953  _sendButtonEvents = false;
954  }
955 }
956 
957 
958 void YQWizard::disconnectNotify ( const char * signal )
959 {
960  if ( QString( signal ).contains( "nextClicked()" ) )
961  {
962  yuiDebug() << "nextClicked disconnected, directly sending button events again" << std::endl;
963  _sendButtonEvents = true;
964  }
965 }
966 
967 
968 void YQWizard::setDialogIcon( const std::string & iconName )
969 {
970  if ( _dialogIcon )
971  {
972  if ( ! iconName.empty() )
973  {
974  QPixmap icon( iconName.c_str() );
975 
976  if ( icon.isNull() )
977  yuiWarning() << "Couldn't load dialog icon \"" << iconName << "\"" << std::endl;
978  else
979  {
980  _dialogIcon->setPixmap( icon );
981  topLevelWidget()->setWindowIcon( icon );
982  }
983  }
984  else
985  {
986  _dialogIcon->clear();
987  topLevelWidget()->setWindowIcon( QIcon() );
988  }
989  }
990 }
991 
992 
993 void YQWizard::setDialogTitle( const std::string & titleText )
994 {
995  QString title = fromUTF8( titleText.c_str() );
996 
997  if ( !title.isEmpty() )
998  topLevelWidget()->setWindowTitle( YQUI::ui()->applicationTitle() + QString(" - ") + title );
999  else
1000  topLevelWidget()->setWindowTitle( YQUI::ui()->applicationTitle() );
1001 }
1002 
1003 
1004 void YQWizard::setDialogHeading( const std::string & headingText )
1005 {
1006  if ( _dialogHeading )
1007  {
1008  if ( ! headingText.empty() )
1009  _dialogHeading->setText( fromUTF8( headingText ) );
1010  else
1011  _dialogHeading->clear();
1012  }
1013 }
1014 
1015 string YQWizard::debugLabel() const
1016 {
1017  if ( _dialogHeading )
1018  {
1019  QString label = _dialogHeading->text();
1020  label = label.simplified(); // Replace any embedded newline with a single blank
1021 
1022  if ( ! label.isEmpty() )
1023  return toUTF8( label );
1024  }
1025 
1026  return "untitled YQWizard";
1027 }
1028 
1029 
1030 void YQWizard::setHelpText( const std::string & helpText )
1031 {
1032  _qHelpText = fromUTF8( helpText );
1033  _qHelpText.replace( "&product;", fromUTF8( YUI::app()->productName() ) );
1034 }
1035 
1036 
1038 {
1039  emit backClicked();
1040 
1041  if ( _sendButtonEvents )
1042  YQUI::ui()->sendEvent( new YWidgetEvent( _backButton, YEvent::Activated ) );
1043 
1044  _direction = YQWizard::Backward;
1045 }
1046 
1047 
1049 {
1050  emit abortClicked();
1051 
1052  if ( _sendButtonEvents )
1053  YQUI::ui()->sendEvent( new YWidgetEvent( _abortButton, YEvent::Activated ) );
1054 }
1055 
1056 
1058 {
1059  emit nextClicked();
1060 
1061  if ( _sendButtonEvents )
1062  YQUI::ui()->sendEvent( new YWidgetEvent( _nextButton, YEvent::Activated ) );
1063 
1064  _direction = YQWizard::Forward;
1065 }
1066 
1067 
1069 {
1070 
1071  if (!_helpDlg)
1072  _helpDlg = new QY2HelpDialog ( _qHelpText, NULL );
1073  else
1074  {
1075  _helpDlg->setHelpText( _qHelpText );
1076  _helpDlg->hide(); // workaround for icewm (see: bnc #397083)
1077  }
1078 
1079  _helpDlg->show();
1080  _helpDlg->raise();
1081  _helpDlg->activateWindow();
1082 }
1083 
1084 
1086 {
1087  // TODO: QT-specific implementation if necessary from UX POV
1088  YDialog::showRelNotesText();
1089 }
1090 
1091 
1093 {
1094  if ( _sideBar && _stepsPanel )
1095  {
1096  _sideBar->setCurrentWidget( _stepsPanel );
1097  }
1098 }
1099 
1100 
1102 {
1103  if ( _sideBar && _treePanel )
1104  {
1105  _sideBar->setCurrentWidget( _treePanel );
1106  }
1107 }
1108 
1109 
1110 void YQWizard::addMenu( const std::string & text,
1111  const std::string & id )
1112 {
1113  if ( _menuBar )
1114  {
1115  QMenu * menu = new QMenu( _menuBar );
1116  YUI_CHECK_NEW( menu );
1117 
1118  _menuIDs.insert( fromUTF8( id ), menu );
1119  _menuBar->addMenu( menu );
1120  menu->setTitle( fromUTF8( text ) );
1121 
1122  connect( menu, &pclass(menu)::triggered,
1123  this, &pclass(this)::sendMenuEvent );
1124 
1125  _menuBar->show();
1126  }
1127 }
1128 
1129 
1130 void YQWizard::addSubMenu( const std::string & parentMenuID,
1131  const std::string & text,
1132  const std::string & id )
1133 {
1134  QMenu* parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1135 
1136  if ( parentMenu )
1137  {
1138  QMenu * menu = new QMenu( _menuBar );
1139  YUI_CHECK_NEW( menu );
1140 
1141  _menuIDs.insert( fromUTF8( id ), menu );
1142  //FIXME parentMenu->insertItem( fromUTF8( text ), menu );
1143 
1144  connect( menu, &pclass(menu)::triggered,
1145  this, &pclass(this)::sendMenuEvent );
1146  }
1147  else
1148  {
1149  yuiError() << "Can't find menu with ID " << parentMenuID << std::endl;
1150  }
1151 }
1152 
1153 
1154 void YQWizard::addMenuEntry( const std::string & parentMenuID,
1155  const std::string & text,
1156  const std::string & idString )
1157 {
1158  QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1159 
1160  if ( parentMenu )
1161  {
1162 #if 0
1163  int id = _menuEntryIDs.size();
1164 #endif
1165  QAction *action;
1166  action = parentMenu->addAction( fromUTF8( text ) );
1167  _menuEntryIDs[ action ] = idString ;
1168 
1169  }
1170  else
1171  {
1172  yuiError() << "Can't find menu with ID " << parentMenuID << std::endl;
1173  }
1174 }
1175 
1176 
1177 void YQWizard::addMenuSeparator( const std::string & parentMenuID )
1178 {
1179  QMenu * parentMenu = _menuIDs[ fromUTF8( parentMenuID ) ];
1180 
1181  if ( parentMenu )
1182  {
1183  parentMenu->addSeparator();
1184  }
1185  else
1186  {
1187  yuiError() << "Can't find menu with ID " << parentMenuID << std::endl;
1188  }
1189 }
1190 
1191 
1193 {
1194  if ( _menuBar )
1195  {
1196  _menuBar->hide();
1197  _menuBar->clear();
1198  _menuIDs.clear();
1199  _menuEntryIDs.clear();
1200  }
1201 }
1202 
1203 
1204 void YQWizard::sendMenuEvent( QAction *action )
1205 {
1206  if ( _menuEntryIDs.contains( action ) )
1207  {
1208  sendEvent( _menuEntryIDs[ action ] );
1209  }
1210  else
1211  {
1212  yuiError() << "Invalid menu ID " << std::endl;
1213  }
1214 }
1215 
1216 
1217 void YQWizard::sendEvent( const std::string & id )
1218 {
1219  YQUI::ui()->sendEvent( new YMenuEvent( id ) );
1220 }
1221 
1222 
1224 {
1225  return sizeHint().width();
1226 }
1227 
1228 
1230 {
1231  return sizeHint().height();
1232 }
1233 
1234 
1235 void YQWizard::setSize( int newWidth, int newHeight )
1236 {
1237  resize( newWidth, newHeight );
1238  resizeClientArea();
1239 }
1240 
1242 {
1243  QSize contentsRect = _clientArea->contentsRect().size();
1244  _contents->setSize( contentsRect.width(), contentsRect.height() );
1245 }
1246 
1247 bool YQWizard::eventFilter( QObject * obj, QEvent * ev )
1248 {
1249  if ( ev->type() == QEvent::Resize && obj == _contents )
1250  {
1251  resizeClientArea();
1252  return true; // Event handled
1253  }
1254 
1255  if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard == this && _stepsPanel )
1256  {
1257  YQMainWinDock::mainWinDock()->setSideBarWidth( _sideBar->width() );
1258  return true; // Event handled
1259  }
1260 
1261  return QWidget::eventFilter( obj, ev );
1262 }
1263 
1264 
1265 void YQWizard::setButtonLabel( YPushButton * button, const std::string & newLabel )
1266 {
1267  button->setLabel( newLabel );
1268  YDialog::currentDialog()->checkShortcuts();
1269 
1270  YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (button);
1271 
1272  if ( wizardButton ) {
1273  // QWizardButton only implements hide and show, not setVisible
1274  if ( newLabel.empty() )
1275  wizardButton->hide();
1276  else
1277  wizardButton->show();
1278  }
1279 }
1280 
1281 
1282 void YQWizard::showReleaseNotesButton( const std::string & label, const std::string & id )
1283 {
1284  if ( ! _releaseNotesButton )
1285  {
1286  yuiError() << "NULL Release Notes button" << std::endl;
1287 
1288  if ( ! _stepsPanel )
1289  yuiError() << "This works only if there is a \"steps\" panel!" << std::endl;
1290 
1291  return;
1292  }
1293 
1294  // no way to check the shortcut, so strip it
1295  _releaseNotesButton->setText( fromUTF8( YShortcut::cleanShortcutString( label ) ) );
1296  _releaseNotesButtonId = id;
1297  _releaseNotesButtonLabel = label;
1298 
1299  _releaseNotesButton->show();
1300 }
1301 
1302 
1304 {
1305  if ( _releaseNotesButton && !_releaseNotesButton->isHidden() )
1306  {
1307  _releaseNotesButton->hide();
1308  _releaseNotesButtonId = "";
1309  _releaseNotesButtonLabel = "";
1310  }
1311 }
1312 
1313 
1315 {
1316  YQUI::setTextdomain( TEXTDOMAIN );
1317 
1318  if ( _helpButton )
1319  // "Help" button - intentionally without keyboard shortcut
1320  _helpButton->setText( _( "Help" ) );
1321 
1322  if ( _stepsButton )
1323  // "Steps" button - intentionally without keyboard shortcut
1324  _stepsButton->setText( _( "Steps" ) );
1325 
1326  if ( _treeButton )
1327  // "Tree" button - intentionally without keyboard shortcut
1328  _treeButton->setText( _( "Tree" ) );
1329 
1330  if ( _helpDlg )
1331  _helpDlg->retranslate();
1332 
1333 }
1334 
1335 
1336 void YQWizard::Step::deleteLabels()
1337 {
1338  delete _statusLabel;
1339  _statusLabel = 0;
1340  delete _nameLabel;
1341  _nameLabel = 0;
1342 }
1343 
1344 
1346 {
1347  deleteLabels();
1348 }
1349 
1350 
1352 {
1353  if ( !_statusLabel || !_nameLabel || _status == s )
1354  return;
1355 
1356  _status = s;
1357 
1358  if ( s == Todo )
1359  {
1360  _statusLabel->setProperty( "class", "todo-step-status QLabel" );
1361  _nameLabel->setProperty ( "class", "todo-step-name QLabel" );
1362  }
1363 
1364  if ( s == Done )
1365  {
1366  _statusLabel->setProperty( "class", "done-step-status QLabel" );
1367  _nameLabel->setProperty ( "class", "done-step-name QLabel" );
1368  }
1369 
1370  if ( s == Current )
1371  {
1372  _statusLabel->setProperty( "class", "current-step-status QLabel" );
1373  _nameLabel->setProperty ( "class", "current-step-name QLabel" );
1374  }
1375 
1376  _statusLabel->style()->unpolish( _statusLabel );
1377  _statusLabel->style()->polish( _statusLabel );
1378  _nameLabel->style()->unpolish( _nameLabel );
1379  _nameLabel->style()->polish( _nameLabel );
1380 }
1381 
1382 #include "YQWizard.moc"
virtual std::string currentTreeSelection()
Returns the current tree selection or an empty std::string if nothing is selected or there is no tree...
Definition: YQWizard.cc:665
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.
Definition: YQWizard.cc:1085
bool isSecondary() const
Returns true if the wizard should follow the first wizard with steps.
Definition: YQWizard.cc:200
virtual void setSortByInsertionSequence(bool sortByInsertionSequence)
Enforce sorting by item insertion order (true) or let user change sorting by clicking on a column hea...
Definition: QY2ListView.cc:355
virtual void setCurrentStep(const std::string &id)
Set the current step.
Definition: YQWizard.cc:479
void resizeClientArea()
Adapt the size of the client area (the ReplacePoint(id(contents)) to fit in its current space...
Definition: YQWizard.cc:1241
virtual ~Step()
Destructor.
Definition: YQWizard.cc:1345
virtual void setDialogIcon(const std::string &iconName)
Set the dialog icon.
Definition: YQWizard.cc:968
void setSideBarWidth(int width)
For secondary wizards.
void destroyButtons()
Destroy the button box's buttons.
Definition: YQWizard.cc:935
virtual void deleteTreeItems()
Delete all tree items.
Definition: YQWizard.cc:610
void sendTreeEvent(QTreeWidgetItem *item)
Internal notification that [Space] or [Return] has been pressed on a tree item.
Definition: YQWizard.cc:646
void showSteps()
Show the current wizard steps, if there are any.
Definition: YQWizard.cc:1092
virtual std::string debugLabel() const
Returns a descriptive label of this dialog instance for debugging.
Definition: YQWizard.cc:1015
Helper class to represent a wizard step heading internally.
Definition: YQWizard.h:671
virtual void setHelpText(const std::string &helpText)
Set the help text.
Definition: YQWizard.cc:1030
virtual void setButtonLabel(YPushButton *button, const std::string &newLabel)
Set the label of one of the wizard buttons (backButton(), abortButton(), nextButton() ) if that butto...
Definition: YQWizard.cc:1265
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
Definition: YQWizard.cc:1235
void connectNotify(const char *signal)
Notification that a signal is being connected.
Definition: YQWizard.cc:948
virtual void clear()
Reimplemented from Q3ListView: Adjust header sizes after clearing contents.
Definition: QY2ListView.cc:102
virtual void deleteSteps()
Delete all steps and step headings from the internal lists.
Definition: YQWizard.cc:519
QString applicationTitle()
Returns the application name for the window title (e.g.
Definition: YQUI.h:298
Helper class for wizard tree item.
Definition: YQWizard.h:691
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...
Definition: YQWizard.cc:1282
virtual bool eventFilter(QObject *obj, QEvent *ev)
Event filter.
Definition: YQWizard.cc:1247
void slotAbortClicked()
Internal notification that the "Abort" button has been clicked.
Definition: YQWizard.cc:1048
virtual void selectTreeItem(const std::string &id)
Select the tree item with the specified ID, if such an item exists.
Definition: YQWizard.cc:629
YQWizard(YWidget *parent, const std::string &backButtonLabel, const std::string &abortButtonLabel, const std::string &nextButtonLabel, YWizardMode wizardMode=YWizardMode_Standard)
Constructor.
Definition: YQWizard.cc:87
void copySteps(YQWizard *wizard)
Create a copy of given wizard's steps set (names & IDs) Populates _stepsList structure of current wiz...
Definition: YQWizard.cc:487
virtual void addStepHeading(const std::string &text)
Add a step heading for the steps panel on the side bar.
Definition: YQWizard.cc:320
void treeSelectionChanged()
Internal notification that the tree selection has changed.
Definition: YQWizard.cc:658
virtual void setDialogHeading(const std::string &headingText)
Set the dialog heading.
Definition: YQWizard.cc:1004
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.
Definition: YQWizard.cc:993
virtual ~YQWizard()
Destructor.
Definition: YQWizard.cc:180
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'.
Definition: YQWizard.cc:1154
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.
Definition: YQWizard.cc:620
void abortClicked()
Emitted when the "Abort" button is clicked.
void setStatus(Status s)
Set text color and status icon for one wizard step.
Definition: YQWizard.cc:1351
virtual void hideReleaseNotesButton()
Hide an existing "Release Notes" button.
Definition: YQWizard.cc:1303
void sendEvent(YEvent *event)
Widget event handlers (slots) call this when an event occured that should be the answer to a UserInpu...
Definition: YQUI.cc:486
void slotBackClicked()
Internal notification that the "Back" button has been clicked.
Definition: YQWizard.cc:1037
virtual void retranslateInternalButtons()
Retranslate internal buttons that are not accessible from the outside:
Definition: YQWizard.cc:1314
virtual void addMenuSeparator(const std::string &parentMenuID)
Add a menu separator to a menu.
Definition: YQWizard.cc:1177
QString currentStep()
Return QString ID of currently active step.
Definition: YQWizard.h:210
virtual void addStep(const std::string &text, const std::string &id)
Add a step for the steps panel on the side bar.
Definition: YQWizard.cc:284
virtual void deleteMenus()
Delete all menus and hide the menu bar.
Definition: YQWizard.cc:1192
Enhanced QTreeWidget.
Definition: QY2ListView.h:47
void showHelp()
Show the current help text.
Definition: YQWizard.cc:1068
virtual void addSubMenu(const std::string &parentMenuID, const std::string &text, const std::string &id)
Add a submenu to the menu with ID 'parentMenuID'.
Definition: YQWizard.cc:1130
void slotNextClicked()
Internal notification that the "Next" button has been clicked.
Definition: YQWizard.cc:1057
YQWizard::Step * findStep(const QString &id)
Find a step with the specified ID.
Definition: YQWizard.cc:534
virtual int preferredHeight()
Preferred height of the widget.
Definition: YQWizard.cc:1229
void showTree()
Show the current selection tree in the side panel, if there is any.
Definition: YQWizard.cc:1101
void sendEvent(const std::string &id)
Send a wizard event with the specified ID.
Definition: YQWizard.cc:1217
Helper class to represent a wizard step internally.
Definition: YQWizard.h:613
virtual void addMenu(const std::string &text, const std::string &id)
Add a menu to the menu bar.
Definition: YQWizard.cc:1110
QList< YQWizard::Step * > stepsList()
Return list of pointers to steps.
Definition: YQWizard.h:182
virtual void addTreeItem(const std::string &parentID, const std::string &text, const std::string &id)
Add a tree item.
Definition: YQWizard.cc:575
void nextClicked()
Emitted when the "Next" or "OK" button is clicked.
void hide()
Hide the associated QPushButton.
void disconnectNotify(const char *signal)
Notification that a signal is being disconnected.
Definition: YQWizard.cc:958
void updateStepStates()
Update all step - use appropriate icons and colors.
Definition: YQWizard.cc:436
void sendMenuEvent(QAction *action)
Internal notification that a menu item with numeric ID 'numID' has been activated.
Definition: YQWizard.cc:1204
virtual int preferredWidth()
Preferred width of the widget.
Definition: YQWizard.cc:1223
static void setTextdomain(const char *domain)
Initialize and set a textdomain for gettext()
Definition: YQUI.cc:506
QString text() const
Returns the button's text (label) - useful for log messages etc.
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.
Definition: YQAlignment.cc:70
static YQUI * ui()
Access the global Qt-UI.
Definition: YQUI.h:81
void show()
Show the associated QPushButton - not this widget itself (!).
virtual void updateSteps()
Update the steps display: Reflect the internal steps and heading lists in the layout.
Definition: YQWizard.cc:327