33 #include <qstringlist.h> 34 #include "QY2ListView.h" 35 #include <QGridLayout> 41 #include <yui/YWizard.h> 42 #include "YQWizardButton.h" 56 class QTreeWidgetItem;
64 class YQWizard :
public QSplitter,
public YWizard
77 const std::string & backButtonLabel,
78 const std::string & abortButtonLabel,
79 const std::string & nextButtonLabel,
80 YWizardMode wizardMode = YWizardMode_Standard );
94 enum Direction { Forward, Backward };
113 virtual YQWizardButton * abortButton()
const {
return _abortButton; }
114 virtual YQWizardButton * nextButton()
const {
return _nextButton; }
116 virtual YReplacePoint * contentsReplacePoint()
const {
return _contentsReplacePoint; }
124 virtual void setButtonLabel( YPushButton * button,
const std::string & newLabel );
131 virtual void setHelpText(
const std::string & helpText );
168 virtual void addStep(
const std::string & text,
const std::string &
id );
184 QList<YQWizard::Step*>
stepsList() {
return _stepsList; }
235 virtual void addTreeItem(
const std::string & parentID,
236 const std::string & text,
237 const std::string &
id );
274 virtual void addMenu(
const std::string & text,
275 const std::string &
id );
282 virtual void addSubMenu(
const std::string & parentMenuID,
283 const std::string & text,
284 const std::string &
id );
292 virtual void addMenuEntry(
const std::string & parentMenuID,
293 const std::string & text,
294 const std::string &
id );
326 const std::string &
id );
350 virtual bool eventFilter( QObject * obj, QEvent * ev );
382 virtual void setSize(
int newWidth,
int newHeight );
488 void layoutTitleBar ( QWidget * parent );
489 QLayout *layoutSideBar ( QWidget * parent );
490 void layoutSideBarButtonBox ( QWidget * parent, QPushButton * button );
491 void layoutStepsPanel();
492 void layoutTreePanel();
493 QWidget *layoutWorkArea ( QWidget * parent );
494 void layoutClientArea ( QWidget * parent );
495 QLayout *layoutButtonBox ( QWidget * parent );
496 bool titleIsOnTheLeft();
511 void sendEvent(
const std::string &
id );
559 std::string _backButtonLabel;
560 std::string _abortButtonLabel;
561 std::string _nextButtonLabel;
564 bool _stepsRegistered;
566 bool _protectNextButton;
568 bool _sendButtonEvents;
569 Direction _direction;
571 QString _currentStepID;
577 QStackedWidget * _sideBar;
578 QWidget * _stepsPanel;
580 static std::string _releaseNotesButtonId;
581 static std::string _releaseNotesButtonLabel;
583 QAction * _helpAction;
584 QPushButton * _stepsButton;
585 QPushButton * _treeButton;
590 QWidget * _clientArea;
592 QLabel * _dialogIcon;
593 QLabel * _dialogLogo;
594 QLabel * _dialogHeading;
599 YReplacePoint * _contentsReplacePoint;
601 QList<YQWizard::Step*> _stepsList;
602 QHash<QString,YQWizard::Step*> _stepsIDs;
603 QHash<QString,YQWizard::TreeItem*> _treeIDs;
604 QHash<QString,QMenu*> _menuIDs;
605 QHash<QAction*, std::string> _menuEntryIDs;
607 QIcon _previousWindowIcon;
621 Step(
const QString & name =
"",
const QString &
id =
"" )
635 virtual bool isHeading()
const {
return false; }
637 enum Status { Unset, Todo, Current, Done };
639 QString name()
const {
return _name; }
640 QLabel * statusLabel()
const {
return _statusLabel; }
641 QLabel * nameLabel()
const {
return _nameLabel; }
642 bool isEnabled()
const {
return _enabled; }
643 const QStringList & id()
const {
return _idList; }
644 void addID(
const QString &
id ) { _idList.append(
id ); }
645 virtual bool hasID(
const QString &
id ) {
return _idList.indexOf(
id ) != -1; }
647 void setStatusLabel( QLabel * label ) { _statusLabel = label; }
648 void setNameLabel ( QLabel * label ) { _nameLabel = label; }
649 void setEnabled(
bool enabled ) { _enabled = enabled; }
661 QLabel * _statusLabel;
668 Q_DISABLE_COPY(
Step);
684 virtual bool isHeading()
const {
return true; }
685 virtual bool hasID(
const QString &
id ) {
return false; }
699 const QString & text,
706 const QString & text,
712 virtual QString text(
int index)
const {
return QTreeWidgetItem::text(index); }
713 QString text()
const {
return QTreeWidgetItem::text(0); }
714 QString id()
const {
return _id; }
virtual std::string currentTreeSelection()
Returns the current tree selection or an empty std::string if nothing is selected or there is no tree...
void showReleaseNotes()
Propagate button clicked event of release notes button to the application.
bool isSecondary() const
Returns true if the wizard should follow the first wizard with steps.
virtual void setCurrentStep(const std::string &id)
Set the current step.
void setButtonFocus(YQWizardButton *button)
Set the keyboard focus to a button.
void resizeClientArea()
Adapt the size of the client area (the ReplacePoint(id(contents)) to fit in its current space...
virtual ~Step()
Destructor.
virtual void setDialogIcon(const std::string &iconName)
Set the dialog icon.
QWidget * workArea() const
Return this wizard's work area (the pane right of the side bar).
void destroyButtons()
Destroy the button box's buttons.
virtual void deleteTreeItems()
Delete all tree items.
Direction direction() const
Returns the current direction of wizard operations - going forward or going backward.
void sendTreeEvent(QTreeWidgetItem *item)
Internal notification that [Space] or [Return] has been pressed on a tree item.
void showSteps()
Show the current wizard steps, if there are any.
virtual std::string debugLabel() const
Returns a descriptive label of this dialog instance for debugging.
Helper class to represent a wizard step heading internally.
virtual void setHelpText(const std::string &helpText)
Set the help text.
virtual void setButtonLabel(YPushButton *button, const std::string &newLabel)
Set the label of one of the wizard buttons (backButton(), abortButton(), nextButton() ) if that butto...
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
void connectNotify(const char *signal)
Notification that a signal is being connected.
virtual void deleteSteps()
Delete all steps and step headings from the internal lists.
Helper class for wizard tree item.
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...
virtual bool eventFilter(QObject *obj, QEvent *ev)
Event filter.
void slotAbortClicked()
Internal notification that the "Abort" button has been clicked.
virtual void selectTreeItem(const std::string &id)
Select the tree item with the specified ID, if such an item exists.
void enableButton(YQWizardButton *button, bool enabled)
Enable or disable a button.
YQWizard(YWidget *parent, const std::string &backButtonLabel, const std::string &abortButtonLabel, const std::string &nextButtonLabel, YWizardMode wizardMode=YWizardMode_Standard)
Constructor.
void copySteps(YQWizard *wizard)
Create a copy of given wizard's steps set (names & IDs) Populates _stepsList structure of current wiz...
virtual void addStepHeading(const std::string &text)
Add a step heading for the steps panel on the side bar.
void treeSelectionChanged()
Internal notification that the tree selection has changed.
virtual void setDialogHeading(const std::string &headingText)
Set the dialog heading.
virtual void setDialogTitle(const std::string &titleText)
Set the dialog title shown in window manager's title bar.
virtual ~YQWizard()
Destructor.
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'.
virtual YQWizardButton * backButton() const
Return internal widgets.
YQWizard::TreeItem * findTreeItem(const std::string &id)
Find a tree item with the specified ID.
void abortClicked()
Emitted when the "Abort" button is clicked.
void setStatus(Status s)
Set text color and status icon for one wizard step.
virtual void hideReleaseNotesButton()
Hide an existing "Release Notes" button.
void slotBackClicked()
Internal notification that the "Back" button has been clicked.
virtual void retranslateInternalButtons()
Retranslate internal buttons that are not accessible from the outside:
virtual void addMenuSeparator(const std::string &parentMenuID)
Add a menu separator to a menu.
QString currentStep()
Return QString ID of currently active step.
virtual void addStep(const std::string &text, const std::string &id)
Add a step for the steps panel on the side bar.
virtual void deleteMenus()
Delete all menus and hide the menu bar.
void showHelp()
Show the current help text.
virtual void addSubMenu(const std::string &parentMenuID, const std::string &text, const std::string &id)
Add a submenu to the menu with ID 'parentMenuID'.
void slotNextClicked()
Internal notification that the "Next" button has been clicked.
YQWizard::Step * findStep(const QString &id)
Find a step with the specified ID.
virtual int preferredHeight()
Preferred height of the widget.
void showTree()
Show the current selection tree in the side panel, if there is any.
void sendEvent(const std::string &id)
Send a wizard event with the specified ID.
Helper class to represent a wizard step internally.
Enhanced QTreeWidgetItem.
virtual void addMenu(const std::string &text, const std::string &id)
Add a menu to the menu bar.
QList< YQWizard::Step * > stepsList()
Return list of pointers to steps.
virtual void addTreeItem(const std::string &parentID, const std::string &text, const std::string &id)
Add a tree item.
void nextClicked()
Emitted when the "Next" or "OK" button is clicked.
void disconnectNotify(const char *signal)
Notification that a signal is being disconnected.
void updateStepStates()
Update all step - use appropriate icons and colors.
void sendMenuEvent(QAction *action)
Internal notification that a menu item with numeric ID 'numID' has been activated.
virtual int preferredWidth()
Preferred width of the widget.
void backClicked()
Emitted when the "Back" or "Cancel" button is clicked.
virtual void updateSteps()
Update the steps display: Reflect the internal steps and heading lists in the layout.