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