a3f7440e010efdd8ebd5450b617a71d5ec9698c1
[qtmeetings] / src / UserInterface / WindowManager.h
1 #ifndef WINDOWMANAGER_H_
2 #define WINDOWMANAGER_H_
3
4 #include <QWidget>
5 #include <QStack>
6
7 // Forward declarations
8 class ViewBase;
9 class QEvent;
10 class QSize;
11 class QDialog;
12 class QString;
13
14 //! UserInterface class. Manages displayed views.
15 /*!
16  * UserInterface class. WindowManager class is responsible for displaying views that inherit the
17  * ViewBase class. It also handles dialog showing. Depending on the views type the WindowManager
18  * can track the views events and restore previous view if the current on is ObservedView. This
19  * is a handy mechanism for screensaver etc.
20  */
21 class WindowManager : public QWidget
22 {
23         Q_OBJECT
24
25 public:
26         //! Constructor.
27         /*!
28          * Constructor of WindowManager.
29          */
30         WindowManager( QWidget *aParent = 0 );
31         //! Destructor.
32         virtual ~WindowManager();
33         
34         virtual bool event(QEvent *event);
35
36         
37         //! Shows any view specific indicators for connection error
38         void connectionLost();
39         
40         //! Removes any view specific indicators for connection error
41         void connectionEstablished();
42
43 signals:
44         //! Request current status of the room.
45         /*!
46          * Signal is emitted when there is need to check current status of room aRoom.
47          * \param aRoom Meetingroom which status is requested.
48          */
49         void eventDetected();
50         
51         //! The view size is changed.
52         /*!
53          * This signal is emitted when the window managers view changes,
54          * i.e. it received resized QEvent.
55          * \param The new view size.
56          */
57         void viewResized(const QSize &newSize, const QSize &oldSize);
58         
59         //! Previous view is restored.
60         /*!
61          * This signal is emitted when previously stored view is
62          * restored. This happens when view with type ViewMode::ObservedView
63          * is shown and it receives an event that initiates the view
64          * restoring chain.
65          */
66         void previousViewRestored();
67         
68         void dialogActivated();
69         void dialogDeactivated();
70
71 public slots:
72         //! Shows the view.
73         /*!
74          * Show view that inherits ViewBase class. If the views parent is not
75          * the WindowManager it will changed within this method. Depeding on the
76          * views type the currently active view might be stored and restored
77          * when specific event occurs in the view to be displayed.
78          */
79         void showView( ViewBase *view );
80         
81         //! Shows modal dialog.
82         /*!
83          * Shows modal dialog. Emits dialogActivated() signal prior calling
84          * QDialog's exec() method and emits dialogDeactivated signal when
85          * the exec() method returns.
86          */
87         void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );
88         
89         //! View event is detected.
90         /*!
91          * WindowManager connects this slot to ViewBase classes eventDetected()
92          * signal and either emits eventDetected() signal if the current views
93          * type is ViewMode::NormalView or restores possible previous view
94          * if the current views type is ViewMode::ObservedView.
95          */
96         void viewEventDetected();
97         
98         void setFullscreen();
99         
100         void error( const QString &aErrorMessage );
101
102 private:
103         //! Name of the application.
104         QString iApplicationName;
105         
106         //! Currently active view.
107         ViewBase *iCurrentView;
108         
109         //! Stack of views previously displayed.
110         QStack<ViewBase *> iViewList;
111
112 };
113
114 #endif /*WINDOWMANAGER_H_*/