1.0.6 candidate
[qtmeetings] / src / UserInterface / WindowManager.h
1 #ifndef WINDOWMANAGER_H_
2 #define WINDOWMANAGER_H_
3
4 #include <QMainWindow>
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 QMainWindow
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 signals:
37         //! Request current status of the room.
38         /*!
39          * Signal is emitted when there is need to check current status of room aRoom.
40          * \param aRoom Meetingroom which status is requested.
41          */
42         void eventDetected();
43         
44         //! The view size is changed.
45         /*!
46          * This signal is emitted when the window managers view changes,
47          * i.e. it received resized QEvent.
48          * \param The new view size.
49          */
50         void viewResized(const QSize &newSize, const QSize &oldSize);
51         
52         //! Previous view is restored.
53         /*!
54          * This signal is emitted when previously stored view is
55          * restored. This happens when view with type ViewMode::ObservedView
56          * is shown and it receives an event that initiates the view
57          * restoring chain.
58          */
59         void previousViewRestored();
60         
61         void showSettingsClicked();
62
63         void closeClicked();
64
65         void dialogActivated();
66         void dialogDeactivated();
67
68 public slots:
69         //! Shows the view.
70         /*!
71          * Show view that inherits ViewBase class. If the views parent is not
72          * the WindowManager it will changed within this method. Depeding on the
73          * views type the currently active view might be stored and restored
74          * when specific event occurs in the view to be displayed.
75          */
76         void showView( ViewBase *view );
77         
78         //! Shows modal dialog.
79         /*!
80          * Shows modal dialog. Emits dialogActivated() signal prior calling
81          * QDialog's exec() method and emits dialogDeactivated signal when
82          * the exec() method returns.
83          */
84         void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );
85         
86         //! View event is detected.
87         /*!
88          * WindowManager connects this slot to ViewBase classes eventDetected()
89          * signal and either emits eventDetected() signal if the current views
90          * type is ViewMode::NormalView or restores possible previous view
91          * if the current views type is ViewMode::ObservedView.
92          */
93         void viewEventDetected();
94         
95         void setFullscreen();
96         
97         void error( const QString &aErrorMessage );
98
99 private:
100         //! Name of the application.
101         QString iApplicationName;
102         
103         //! Currently active view.
104         ViewBase *iCurrentView;
105         
106         //! Stack of views previously displayed.
107         QStack<ViewBase *> iViewList;
108
109         //! Menu settings
110     QAction *settingsAction;
111     //! Menu close application
112     QAction *closeAction;
113     //! Edit menu
114     QMenu *editMenu;
115 };
116
117 #endif /*WINDOWMANAGER_H_*/