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