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