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