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 );
493 void layoutTitleBar ( QWidget * parent );
494 QLayout *layoutSideBar ( QWidget * parent );
495 void layoutSideBarButtonBox ( QWidget * parent, QPushButton * button );
496 void layoutStepsPanel();
497 void layoutTreePanel();
498 QWidget *layoutWorkArea ( QWidget * parent );
499 void layoutClientArea ( QWidget * parent );
500 QLayout *layoutButtonBox ( QWidget * parent );
501 bool titleIsOnTheLeft();
516 void sendEvent(
const std::string &
id );
564 std::string _backButtonLabel;
565 std::string _abortButtonLabel;
566 std::string _nextButtonLabel;
569 bool _stepsRegistered;
571 bool _protectNextButton;
573 bool _sendButtonEvents;
574 Direction _direction;
576 QString _currentStepID;
578 QString _qHotkeysText;
584 QStackedWidget * _sideBar;
585 QWidget * _stepsPanel;
587 static std::string _releaseNotesButtonId;
588 static std::string _releaseNotesButtonLabel;
590 QAction * _helpAction;
591 QAction * _hotkeysAction;
592 QPushButton * _stepsButton;
593 QPushButton * _treeButton;
598 QWidget * _clientArea;
600 QLabel * _dialogIcon;
601 QLabel * _dialogLogo;
602 QLabel * _dialogHeading;
607 YReplacePoint * _contentsReplacePoint;
609 QList<YQWizard::Step*> _stepsList;
610 QHash<QString,YQWizard::Step*> _stepsIDs;
611 QHash<QString,YQWizard::TreeItem*> _treeIDs;
612 QHash<QString,QMenu*> _menuIDs;
613 QHash<QAction*, std::string> _menuEntryIDs;
615 QIcon _previousWindowIcon;
629 Step(
const QString & name =
"",
const QString &
id =
"" )
643 virtual bool isHeading()
const {
return false; }
645 enum Status { Unset, Todo, Current, Done };
647 QString name()
const {
return _name; }
648 QLabel * statusLabel()
const {
return _statusLabel; }
649 QLabel * nameLabel()
const {
return _nameLabel; }
650 bool isEnabled()
const {
return _enabled; }
651 const QStringList & id()
const {
return _idList; }
652 void addID(
const QString &
id ) { _idList.append(
id ); }
653 virtual bool hasID(
const QString &
id ) {
return _idList.indexOf(
id ) != -1; }
655 void setStatusLabel( QLabel * label ) { _statusLabel = label; }
656 void setNameLabel ( QLabel * label ) { _nameLabel = label; }
657 void setEnabled(
bool enabled ) { _enabled = enabled; }
669 QLabel * _statusLabel;
676 Q_DISABLE_COPY(
Step);
692 virtual bool isHeading()
const {
return true; }
693 virtual bool hasID(
const QString &
id ) {
return false; }
707 const QString & text,
714 const QString & text,
720 virtual QString text(
int index)
const {
return QTreeWidgetItem::text(index); }
721 QString text()
const {
return QTreeWidgetItem::text(0); }
722 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.
virtual void setCurrentStep(const std::string &id)
Set the current step.
QWidget * workArea() const
Return this wizard's work area (the pane right of the side bar).
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.
Direction direction() const
Returns the current direction of wizard operations - going forward or going backward.
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.
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.
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 YQWizardButton * backButton() const
Return internal widgets.
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.
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'.
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 showHotkeys()
Show an overview of the power-user hotkeys.
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.
virtual std::string debugLabel() const
Returns a descriptive label of this dialog instance for debugging.