From 83b1d47ddd0006f846ff43fd0d3e83218081abd3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sami=20R=C3=A4m=C3=B6?= Date: Fri, 3 Sep 2010 12:26:46 +0300 Subject: [PATCH] Documentation --- src/ui/listitemcontextbuttonbar.h | 91 +++++++++++++++++++++++++++++++------ src/ui/panelbase.h | 15 ++++++ src/ui/tabbedpanel.h | 7 ++- 3 files changed, 99 insertions(+), 14 deletions(-) diff --git a/src/ui/listitemcontextbuttonbar.h b/src/ui/listitemcontextbuttonbar.h index 7b4a357..71be646 100644 --- a/src/ui/listitemcontextbuttonbar.h +++ b/src/ui/listitemcontextbuttonbar.h @@ -19,7 +19,6 @@ USA. */ - #ifndef LISTITEMCONTEXTBUTTONBAR_H #define LISTITEMCONTEXTBUTTONBAR_H @@ -27,39 +26,105 @@ class QPropertyAnimation; +/** + * @brief Button bar for list item relatex context buttons + * + * @author Sami Rämö - sami.ramo (at) ixonos.com + */ class ListItemContextButtonBar : public QWidget { Q_OBJECT public: + /** + * @brief Constructor + * + * @param parent Parent + */ explicit ListItemContextButtonBar(QWidget *parent = 0); + /** + * @brief Destructor + * + * Deletes images. + */ ~ListItemContextButtonBar(); +/******************************************************************************* + * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS + ******************************************************************************/ +private: + /** + * @brief Paint the background of the item + * + * @param event Paint event + */ void paintEvent(QPaintEvent *event); +/******************************************************************************* + * MEMBER FUNCTIONS AND SLOTS + ******************************************************************************/ +public: + /** + * @brief Start hiding animation + */ void hideContextButtonBar(); /** - * @brief Sets the context buttons to the context button bar + * @brief Set new context buttons * - * @param contextButtons Pointer to context buttons + * If bar is hidden, then changeButtons() is called. Otherwise pointer to new buttons is saved + * and hideContextButtonBar() is called. + * + * @param contextButtons Pointer to new context buttons */ void setContextButtons(QWidget *contextButtons); + /** + * @brief Start showing animation + * + * Animation is started only if the bar contains buttons. + */ void showContextButtonBar(); -signals: - public slots: + /** + * @brief Shows and hides the bar when item selection is changed + * + * Calls showContextButtonBar() or hideContextButtonBar() if changing the state of the bar is + * required. If there is a pointer to new buttons, then request is remembered instead of + * changing the state immediately. + * + * @param itemIsSelected True is any item is selected + */ void onListItemSelectionChanged(bool itemIsSelected); private: + /** + * @brief Do the actual changing of the buttons + * + * Does also re-sizing and re-positioning of the bar and sets new values for animation. + */ void changeButtons(); private slots: + /** + * @brief + * + * If bar was just hidden, then calls changeButtons() if there is a pointer to new buttons + * saved. If changing the buttons was done, then also checks if showing the bar was requested + * and calls showContextButtonBar() if needed. + */ void onAnimationFinished(); +/******************************************************************************* + * DATA MEMBERS + ******************************************************************************/ private: + /** + * @brief States for the animation + * + * @enum AnimationState + */ enum AnimationState { StateHidden, StateOpening, @@ -67,18 +132,18 @@ private: StateVisible }; - bool m_waitForOpen; + bool m_waitForOpen; ///< Is showing requested while chaging buttons is not ready - QPixmap *m_backgroundLeft; - QPixmap *m_backgroundMiddle; - QPixmap *m_backgroundRight; + QPixmap *m_backgroundLeft; ///< Background picture, left part + QPixmap *m_backgroundMiddle; ///< Background picture, center part + QPixmap *m_backgroundRight; ///< Background picture, right part - QPropertyAnimation *m_animation; + QPropertyAnimation *m_animation; ///< Sliding animation for show/hide - QWidget *m_contextButtons; ///< Widget for context buttons - QWidget *m_newContextButtons; ///< Temporary pointer for new context buttons + QWidget *m_contextButtons; ///< Widget for context buttons + QWidget *m_newContextButtons; ///< Temporary pointer for new context buttons - AnimationState m_state; + AnimationState m_state; ///< Current state of the animation }; #endif // LISTITEMCONTEXTBUTTONBAR_H diff --git a/src/ui/panelbase.h b/src/ui/panelbase.h index 6812113..dee16ab 100644 --- a/src/ui/panelbase.h +++ b/src/ui/panelbase.h @@ -60,9 +60,19 @@ public: */ QWidget* genericPanelButtons() const; + /** + * @brief Getter for the list item related context buttons + * + * @returns Pointer to context buttons widget + */ QWidget* itemButtons() const; protected slots: + /** + * @brief Call when there is a change in list item selection + * + * Emits listItemSelectionChanged(bool). Parameter is true if any item is selected. + */ void onListItemSelectionChanged(); /******************************************************************************* @@ -76,6 +86,11 @@ signals: */ void openPanelRequested(QWidget *widget); + /** + * @brief Emitted when there is a change in list item selection + * + * @param itemIsSelected True if any item is selected. + */ void listItemSelectionChanged(bool itemIsSelected); /******************************************************************************* diff --git a/src/ui/tabbedpanel.h b/src/ui/tabbedpanel.h index ecd7899..87a056d 100644 --- a/src/ui/tabbedpanel.h +++ b/src/ui/tabbedpanel.h @@ -163,6 +163,11 @@ signals: */ void currentChanged(int index); + /** + * @brief Emitted when there is a change in list item selection + * + * @param itemIsSelected True if any item is selected. + */ void listItemSelectionChanged(bool itemIsSelected); /** @@ -199,7 +204,7 @@ private: QState *m_stateClosed; ///< State of the closed panel QState *m_stateOpened; ///< State of the opened panel - ListItemContextButtonBar *m_itemContextButtonBar; + ListItemContextButtonBar *m_itemContextButtonBar; ///< Widget for list item context button bar PanelBar *m_panelBar; ///< Widget for panel bar PanelContentStack *m_panelContentStack; ///< Stack for panel widgets PanelContextButtonBar * m_panelContextButtonBar; ///< Widget for panel context button bar -- 1.7.9.5