33 #include <qstringlist.h> 34 #include "QY2ListView.h" 35 #include <QGridLayout> 40 #include <yui/YWizard.h> 41 #include "YQWizardButton.h" 55 class QTreeWidgetItem;
63 class YQWizard :
public QSplitter,
public YWizard
76 const std::string & backButtonLabel,
77 const std::string & abortButtonLabel,
78 const std::string & nextButtonLabel,
79 YWizardMode wizardMode = YWizardMode_Standard );
93 enum Direction { Forward, Backward };
112 virtual YQWizardButton * abortButton()
const {
return _abortButton; }
113 virtual YQWizardButton * nextButton()
const {
return _nextButton; }
115 virtual YReplacePoint * contentsReplacePoint()
const {
return _contentsReplacePoint; }
123 virtual void setButtonLabel( YPushButton * button,
const std::string & newLabel );
130 virtual void setHelpText(
const std::string & helpText );
167 virtual void addStep(
const std::string & text,
const std::string &
id );
183 QList<YQWizard::Step*>
stepsList() {
return _stepsList; }
234 virtual void addTreeItem(
const std::string & parentID,
235 const std::string & text,
236 const std::string &
id );
273 virtual void addMenu(
const std::string & text,
274 const std::string &
id );
281 virtual void addSubMenu(
const std::string & parentMenuID,
282 const std::string & text,
283 const std::string &
id );
291 virtual void addMenuEntry(
const std::string & parentMenuID,
292 const std::string & text,
293 const std::string &
id );
325 const std::string &
id );
349 virtual bool eventFilter( QObject * obj, QEvent * ev );
381 virtual void setSize(
int newWidth,
int newHeight );
487 void layoutTitleBar ( QWidget * parent );
488 QLayout *layoutSideBar ( QWidget * parent );
489 void layoutSideBarButtonBox ( QWidget * parent, QPushButton * button );
490 void layoutStepsPanel();
491 void layoutTreePanel();
492 QWidget *layoutWorkArea ( QWidget * parent );
493 void layoutClientArea ( QWidget * parent );
494 QLayout *layoutButtonBox ( QWidget * parent );
495 bool titleIsOnTheLeft();
510 void sendEvent(
const std::string &
id );
558 std::string _backButtonLabel;
559 std::string _abortButtonLabel;
560 std::string _nextButtonLabel;
563 bool _stepsRegistered;
565 bool _protectNextButton;
567 bool _sendButtonEvents;
568 Direction _direction;
570 QString _currentStepID;
576 QStackedWidget * _sideBar;
577 QWidget * _stepsPanel;
579 static std::string _releaseNotesButtonId;
580 static std::string _releaseNotesButtonLabel;
582 QPushButton * _stepsButton;
583 QPushButton * _treeButton;
588 QWidget * _clientArea;
590 QLabel * _dialogIcon;
591 QLabel * _dialogLogo;
592 QLabel * _dialogHeading;
597 YReplacePoint * _contentsReplacePoint;
599 QList<YQWizard::Step*> _stepsList;
600 QHash<QString,YQWizard::Step*> _stepsIDs;
601 QHash<QString,YQWizard::TreeItem*> _treeIDs;
602 QHash<QString,QMenu*> _menuIDs;
603 QHash<QAction*, std::string> _menuEntryIDs;
605 QIcon _previousWindowIcon;
619 Step(
const QString & name =
"",
const QString &
id =
"" )
633 virtual bool isHeading()
const {
return false; }
635 enum Status { Unset, Todo, Current, Done };
637 QString name()
const {
return _name; }
638 QLabel * statusLabel()
const {
return _statusLabel; }
639 QLabel * nameLabel()
const {
return _nameLabel; }
640 bool isEnabled()
const {
return _enabled; }
641 const QStringList & id()
const {
return _idList; }
642 void addID(
const QString &
id ) { _idList.append(
id ); }
643 virtual bool hasID(
const QString &
id ) {
return _idList.indexOf(
id ) != -1; }
645 void setStatusLabel( QLabel * label ) { _statusLabel = label; }
646 void setNameLabel ( QLabel * label ) { _nameLabel = label; }
647 void setEnabled(
bool enabled ) { _enabled = enabled; }
659 QLabel * _statusLabel;
666 Q_DISABLE_COPY(
Step);
682 virtual bool isHeading()
const {
return true; }
683 virtual bool hasID(
const QString &
id ) {
return false; }
697 const QString & text,
704 const QString & text,
710 virtual QString text(
int index)
const {
return QTreeWidgetItem::text(index); }
711 QString text()
const {
return QTreeWidgetItem::text(0); }
712 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.