33 #include <qstringlist.h>
34 #include "QY2ListView.h"
35 #include <QGridLayout>
40 #include <yui/YWizard.h>
41 #include "YQWizardButton.h"
55 class QTreeWidgetItem;
62 class YQWizard :
public QSplitter,
public YWizard
75 const std::string & backButtonLabel,
76 const std::string & abortButtonLabel,
77 const std::string & nextButtonLabel,
78 YWizardMode wizardMode = YWizardMode_Standard );
92 enum Direction { Forward, Backward };
111 virtual YQWizardButton * abortButton()
const {
return _abortButton; }
112 virtual YQWizardButton * nextButton()
const {
return _nextButton; }
114 virtual YReplacePoint * contentsReplacePoint()
const {
return _contentsReplacePoint; }
122 virtual void setButtonLabel( YPushButton * button,
const std::string & newLabel );
129 virtual void setHelpText(
const std::string & helpText );
166 virtual void addStep(
const std::string & text,
const std::string &
id );
182 QList<YQWizard::Step*>
stepsList() {
return _stepsList; }
233 virtual void addTreeItem(
const std::string & parentID,
234 const std::string & text,
235 const std::string &
id );
272 virtual void addMenu(
const std::string & text,
273 const std::string &
id );
280 virtual void addSubMenu(
const std::string & parentMenuID,
281 const std::string & text,
282 const std::string &
id );
290 virtual void addMenuEntry(
const std::string & parentMenuID,
291 const std::string & text,
292 const std::string &
id );
324 const std::string &
id );
348 virtual bool eventFilter( QObject * obj, QEvent * ev );
380 virtual void setSize(
int newWidth,
int newHeight );
486 void layoutTitleBar ( QWidget * parent );
487 QLayout *layoutSideBar ( QWidget * parent );
488 void layoutSideBarButtonBox ( QWidget * parent, QPushButton * button );
489 void layoutStepsPanel();
490 void layoutTreePanel();
491 QWidget *layoutWorkArea ( QWidget * parent );
492 void layoutClientArea ( QWidget * parent );
493 QLayout *layoutButtonBox ( QWidget * parent );
494 bool titleIsOnTheLeft();
509 void sendEvent(
const std::string &
id );
557 std::string _backButtonLabel;
558 std::string _abortButtonLabel;
559 std::string _nextButtonLabel;
562 bool _stepsRegistered;
564 bool _protectNextButton;
566 bool _sendButtonEvents;
567 Direction _direction;
569 QString _currentStepID;
574 QStackedWidget * _sideBar;
575 QWidget * _stepsPanel;
576 QPushButton * _releaseNotesButton;
577 static std::string _releaseNotesButtonId;
578 static std::string _releaseNotesButtonLabel;
579 QPushButton * _helpButton;
580 QPushButton * _stepsButton;
581 QPushButton * _treeButton;
586 QWidget * _clientArea;
588 QLabel * _dialogIcon;
589 QLabel * _dialogLogo;
590 QLabel * _dialogHeading;
595 YReplacePoint * _contentsReplacePoint;
597 QList<YQWizard::Step*> _stepsList;
598 QHash<QString,YQWizard::Step*> _stepsIDs;
599 QHash<QString,YQWizard::TreeItem*> _treeIDs;
600 QHash<QString,QMenu*> _menuIDs;
601 QHash<QAction*, std::string> _menuEntryIDs;
603 QIcon _previousWindowIcon;
617 Step(
const QString & name =
"",
const QString &
id =
"" )
631 virtual bool isHeading()
const {
return false; }
633 enum Status { Unset, Todo, Current, Done };
635 QString name()
const {
return _name; }
636 QLabel * statusLabel()
const {
return _statusLabel; }
637 QLabel * nameLabel()
const {
return _nameLabel; }
638 bool isEnabled()
const {
return _enabled; }
639 const QStringList & id()
const {
return _idList; }
640 void addID(
const QString &
id ) { _idList.append(
id ); }
641 virtual bool hasID(
const QString &
id ) {
return _idList.indexOf(
id ) != -1; }
643 void setStatusLabel( QLabel * label ) { _statusLabel = label; }
644 void setNameLabel ( QLabel * label ) { _nameLabel = label; }
645 void setEnabled(
bool enabled ) { _enabled = enabled; }
657 QLabel * _statusLabel;
664 Q_DISABLE_COPY(
Step);
680 virtual bool isHeading()
const {
return true; }
681 virtual bool hasID(
const QString &
id ) {
return false; }
695 const QString & text,
702 const QString & text,
708 virtual QString text(
int index)
const {
return QTreeWidgetItem::text(index); }
709 QString text()
const {
return QTreeWidgetItem::text(0); }
710 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.
QY2ListViewItem(QY2ListView *parentListView, const QString &text=QString::null)
Constructor for toplevel 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.