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 );
181 virtual void addStep(
const std::string & text,
const std::string &
id );
197 QList<YQWizard::Step*>
stepsList() {
return _stepsList; }
248 virtual void addTreeItem(
const std::string & parentID,
249 const std::string & text,
250 const std::string &
id );
287 virtual void addMenu(
const std::string & text,
288 const std::string &
id );
295 virtual void addSubMenu(
const std::string & parentMenuID,
296 const std::string & text,
297 const std::string &
id );
305 virtual void addMenuEntry(
const std::string & parentMenuID,
306 const std::string & text,
307 const std::string &
id );
339 const std::string &
id );
363 virtual bool eventFilter( QObject * obj, QEvent * ev );
395 virtual void setSize(
int newWidth,
int newHeight );
506 void layoutTitleBar ( QWidget * parent );
507 QLayout *layoutSideBar ( QWidget * parent );
508 void layoutSideBarButtonBox ( QWidget * parent, QPushButton * button );
509 void layoutStepsPanel();
510 void layoutTreePanel();
511 QWidget *layoutWorkArea ( QWidget * parent );
512 void layoutClientArea ( QWidget * parent );
513 QLayout *layoutButtonBox ( QWidget * parent );
514 bool titleIsOnTheLeft();
529 void sendEvent(
const std::string &
id );
577 std::string _backButtonLabel;
578 std::string _abortButtonLabel;
579 std::string _nextButtonLabel;
582 bool _stepsRegistered;
584 bool _protectNextButton;
586 bool _sendButtonEvents;
587 Direction _direction;
589 QString _currentStepID;
591 QString _qHotkeysText;
597 QStackedWidget * _sideBar;
598 QWidget * _stepsPanel;
600 static std::string _releaseNotesButtonId;
601 static std::string _releaseNotesButtonLabel;
603 QAction * _helpAction;
604 QAction * _hotkeysAction;
605 QPushButton * _stepsButton;
606 QPushButton * _treeButton;
611 QWidget * _clientArea;
613 QLabel * _dialogIcon;
614 QLabel * _dialogLogo;
615 QLabel * _dialogBanner;
616 QLabel * _dialogHeading;
621 YReplacePoint * _contentsReplacePoint;
623 QList<YQWizard::Step*> _stepsList;
624 QHash<QString,YQWizard::Step*> _stepsIDs;
625 QHash<QString,YQWizard::TreeItem*> _treeIDs;
626 QHash<QString,QMenu*> _menuIDs;
627 QHash<QAction*, std::string> _menuEntryIDs;
629 QIcon _previousWindowIcon;
643 Step(
const QString & name =
"",
const QString &
id =
"" )
657 virtual bool isHeading()
const {
return false; }
659 enum Status { Unset, Todo, Current, Done };
661 QString name()
const {
return _name; }
662 QLabel * statusLabel()
const {
return _statusLabel; }
663 QLabel * nameLabel()
const {
return _nameLabel; }
664 bool isEnabled()
const {
return _enabled; }
665 const QStringList & id()
const {
return _idList; }
666 void addID(
const QString &
id ) { _idList.append(
id ); }
667 virtual bool hasID(
const QString &
id ) {
return _idList.indexOf(
id ) != -1; }
669 void setStatusLabel( QLabel * label ) { _statusLabel = label; }
670 void setNameLabel ( QLabel * label ) { _nameLabel = label; }
671 void setEnabled(
bool enabled ) { _enabled = enabled; }
683 QLabel * _statusLabel;
690 Q_DISABLE_COPY(
Step);
706 virtual bool isHeading()
const {
return true; }
707 virtual bool hasID(
const QString &
id ) {
return false; }
721 const QString & text,
728 const QString & text,
734 virtual QString text(
int index)
const {
return QTreeWidgetItem::text(index); }
735 QString text()
const {
return QTreeWidgetItem::text(0); }
736 QString id()
const {
return _id; }
Enhanced QTreeWidgetItem.
QY2ListViewItem(QY2ListView *parentListView, const QString &text=QString())
Constructor for toplevel items.
Helper class to represent a wizard step heading internally.
Helper class to represent a wizard step internally.
virtual ~Step()
Destructor.
void setStatus(Status s)
Set text color and status icon for one wizard step.
Helper class for wizard tree item.
virtual void addStep(const std::string &text, const std::string &id)
Add a step for the steps panel on the side bar.
virtual void setButtonLabel(YPushButton *button, const std::string &newLabel)
Set the label of one of the wizard buttons (backButton(), abortButton(), nextButton() ) if that butto...
void destroyButtons()
Destroy the button box's buttons.
virtual int preferredHeight()
Preferred height of the widget.
virtual void addSubMenu(const std::string &parentMenuID, const std::string &text, const std::string &id)
Add a submenu to the menu with ID 'parentMenuID'.
virtual void setCurrentStep(const std::string &id)
Set the current step.
virtual std::string getDialogHeading()
Get the dialog heading.
void sendEvent(const std::string &id)
Send a wizard event with the specified ID.
virtual YQWizardButton * backButton() const
Return internal widgets.
virtual std::string getDialogTitle()
Get the current dialog title shown in the window manager's title bar.
YQWizard(YWidget *parent, const std::string &backButtonLabel, const std::string &abortButtonLabel, const std::string &nextButtonLabel, YWizardMode wizardMode=YWizardMode_Standard)
Constructor.
QWidget * workArea() const
Return this wizard's work area (the pane right of the side bar).
QString currentStep()
Return QString ID of currently active step.
void resizeClientArea()
Adapt the size of the client area (the ReplacePoint(id(contents)) to fit in its current space.
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 void setSize(int newWidth, int newHeight)
Set the new size of the widget.
void showHotkeys()
Show an overview of the power-user hotkeys.
void slotNextClicked()
Internal notification that the "Next" button has been clicked.
void showHelp()
Show the current help text.
void showReleaseNotes()
Propagate button clicked event of release notes button to the application.
virtual void deleteMenus()
Delete all menus and hide the menu bar.
virtual void hideReleaseNotesButton()
Hide an existing "Release Notes" button.
virtual ~YQWizard()
Destructor.
virtual void deleteSteps()
Delete all steps and step headings from the internal lists.
bool isSecondary() const
Returns true if the wizard should follow the first wizard with steps.
virtual void setDialogHeading(const std::string &headingText)
Set the dialog heading.
YQWizard::Step * findStep(const QString &id)
Find a step with the specified ID.
void connectNotify(const char *signal)
Notification that a signal is being connected.
virtual int preferredWidth()
Preferred width of the widget.
void backClicked()
Emitted when the "Back" or "Cancel" button is clicked.
void abortClicked()
Emitted when the "Abort" button is clicked.
virtual bool eventFilter(QObject *obj, QEvent *ev)
Event filter.
virtual void addStepHeading(const std::string &text)
Add a step heading for the steps panel on the side bar.
void disconnectNotify(const char *signal)
Notification that a signal is being disconnected.
void setButtonLabel(YQWizardButton *button, const QString &newLabel)
Set a button's label.
void nextClicked()
Emitted when the "Next" or "OK" button is clicked.
virtual void selectTreeItem(const std::string &id)
Select the tree item with the specified ID, if such an item exists.
QList< YQWizard::Step * > stepsList()
Return list of pointers to steps.
void setButtonFocus(YQWizardButton *button)
Set the keyboard focus to a button.
void enableButton(YQWizardButton *button, bool enabled)
Enable or disable a button.
void showSteps()
Show the current wizard steps, if there are any.
virtual void setHelpText(const std::string &helpText)
Set the help text.
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 void updateSteps()
Update the steps display: Reflect the internal steps and heading lists in the layout.
YQWizard::TreeItem * findTreeItem(const std::string &id)
Find a tree item with the specified ID.
void sendTreeEvent(QTreeWidgetItem *item)
Internal notification that [Space] or [Return] has been pressed on a tree item.
virtual void setDialogTitle(const std::string &titleText)
Set the dialog title shown in window manager's title bar.
virtual void addMenu(const std::string &text, const std::string &id)
Add a menu to the menu bar.
virtual std::string debugLabel() const
Returns a descriptive label of this dialog instance for debugging.
void sendMenuEvent(QAction *action)
Internal notification that a menu item with numeric ID 'numID' has been activated.
virtual void addTreeItem(const std::string &parentID, const std::string &text, const std::string &id)
Add a tree item.
virtual void addMenuSeparator(const std::string &parentMenuID)
Add a menu separator to a menu.
virtual void retranslateInternalButtons()
Retranslate internal buttons that are not accessible from the outside:
virtual void setDialogIcon(const std::string &iconName)
Set the dialog icon.
void slotBackClicked()
Internal notification that the "Back" button has been clicked.
void slotAbortClicked()
Internal notification that the "Abort" button has been clicked.
Direction direction() const
Returns the current direction of wizard operations - going forward or going backward.
virtual void deleteTreeItems()
Delete all tree items.
void updateStepStates()
Update all step - use appropriate icons and colors.
void treeSelectionChanged()
Internal notification that the tree selection has changed.
virtual std::string currentTreeSelection()
Returns the current tree selection or an empty std::string if nothing is selected or there is no tree...
void copySteps(YQWizard *wizard)
Create a copy of given wizard's steps set (names & IDs) Populates _stepsList structure of current wiz...
void showTree()
Show the current selection tree in the side panel, if there is any.