Changes to screen saver mode connection status handling
[qtmeetings] / src / UserInterface / Views / ViewBase.h
1 #ifndef VIEWBASE_
2 #define VIEWBASE_
3
4 #include <QWidget>
5
6 class QEvent;
7 class QSize;
8
9 class ViewBase : public QWidget
10 {
11         Q_OBJECT
12         
13 public:
14         enum ViewMode
15         {
16                 NormalView, /*!< Indicates that the view is normal view that isn't hidden by events. */
17                 ObservedView /*!< Indicates that the view will be hidden when event occurs. */
18         };
19         
20 public:
21         ViewBase( ViewBase::ViewMode aMode, QWidget *aParent = 0 );
22         virtual ~ViewBase();
23         
24         //! Overwritten event handler.
25         /*!
26          * Listens for events and emits eventDetected signal when observed
27          * event is triggered.
28          */
29         virtual bool event(QEvent *event);
30         
31         //! Event filter.
32         /*!
33          * Event filter method that is used to listen for child widgets
34          * events.
35          */
36         virtual bool eventFilter(QObject *watched, QEvent *event);
37         
38         //! Returns view mode.
39         /*!
40          * Returns the views mode which is one of the ViewMode enumerations.
41          */
42         ViewBase::ViewMode viewMode();
43         
44 public slots:
45         //! This slot is called when the view is resized.
46         /*!
47          * This slot will be called after the view is resized by the window manager
48          * to fit its client area. This method can be used to refine the view size
49          * after it has been resized, for example when the on screen keyboard is
50          * displayed.
51          */
52         virtual void viewResized(const QSize &newSize, const QSize &oldSize) = 0;
53         
54         void connectionEstablished();
55         
56         void connectionLost();
57         
58 signals:
59         /*!
60          * This signal indicates that some user initiated event has occured.
61          * Event filter tracks for mouse, pointer and key events.
62          */
63         void eventDetected();
64         
65 protected:
66         void observeChild(QWidget *aChild);
67         bool connectionError; // true if last connection attempt failed
68         // TODO: connectedOnce should actually indicate if the current week has been fetched at least once
69         bool connectedOnce;     // true if connection has been formed at least once
70         
71 private:
72         ViewMode iViewMode;
73 };
74
75 #endif /*VIEWBASE_*/