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