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