Merge branch 'master' into master_merge
[qtmeetings] / src / UserInterface / WindowManager.h
index 2267525..2f46050 100644 (file)
-#ifndef WINDOWMANAGER_H_
-#define WINDOWMANAGER_H_
-
-#include <QObject>
-#include <QTime>
-#include "Room.h"
-#include "Meeting.h"
-#include "PasswordDialog.h"
-#include "DeviceManager.h"
-
-class QTimer;
-class RoomStatusIndicatorWidget;
-class WeeklyViewWidget;
-class Engine;
-class MeetingInfoDialog;
-class SettingsView;
-class ProgressBar;
-class Configuration;
-
-//! UserInterface class. Behaves as a proxy between the user interface and application's business logic.
-/*!
- * UserInterface class. Controls the whole user interface, starting with displaying the appropriate
- * views. It behaves as a proxy between the user interface and application's business logic, it connects
- * the specified components together and forwards the data to the correct place. It also manages the correct
- * appearance of current views on the screen.
- */
-class WindowManager : public QObject
-{
-       Q_OBJECT
-
-public:
-       //! Constructor.
-       /*!
-        * Constructor of WindowManager.
-        * \param aConfiguration The pointer to configuration.
-        */
-       WindowManager( Configuration *aConfiguration );
-       //! Destructor.
-       virtual ~WindowManager();
-       /*!
-        * Displays an error message
-        * \param aErrorMessage Message to be displayd
-        */
-       void error( const QString &aErrorMessage );
-       //! Updates the rooms status.
-       /*! 
-        * Forwards the signal of changed status to current view.
-        * \param aRoom Room which status is changed.
-        * \param aStatus Current status of room.
-        * \param aTime Time when status is changed.
-        */
-       void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime );
-       //! Shows the password dialog.
-       /*!
-        * Shows the password dialog.
-        * \param aAdminPassword The correct password.
-        * \param aMessage The message to be shown in the password dialog.
-        */
-       void showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage );
-       //! Closes the password dialog.
-       /*!
-        * Closes the password dialog.
-        */
-       void closePasswordDialog();
-       //! Displays the weekly view.
-       /*!
-        * Displays the weekly view.
-        */
-       void showWeeklyView();
-       //! Displays the meeting info dialog.
-       /*!
-        * Displays the meeting info dialog. 
-        * \param aMeeting Meeting to be displayd
-        */
-       void showMeetingInfo( Meeting *aMeeting );
-       //! Returns the pointer to the weekly view. 
-       /*!
-        * Returns the pointer to the weekly view.
-        */
-       WeeklyViewWidget * weeklyView();
-       //! Switches the views to full screen.
-       /*!
-        * Switches the views to full screen.
-        */
-       void fullScreen();
-       //! Shows the progress bar.
-       /*!
-        * Starts showing the progress bar.
-        * \param aText The text to be shown in progress bar.
-        *  \param aCancellable Is the Cancel button visible. By default not visible.
-        */
-       void showProgressBar( const QString &aText, bool aCancellable = false );
-       //! Closes the progress bar.
-       /*!
-        * Closes the progress bar.
-        */
-       void closeProgressBar();
-       //! Sends the refresh command to weekly view widget.
-       /*!
-        * Sends the refresh command to weekly view widget.
-        * \param aMeetings The list of meetings.
-        */
-       void refreshMeetings( const QList<Meeting*> &aMeetings );
-       
-signals:
-       //! Request current status of the room.
-       /*!
-        * Signal is emitted when there is need to check current status of room aRoom.
-        * \param aRoom Meetingroom which status is requested.
-        */
-       void roomStatusInfoNeeded( Room *aRoom );
-       //! Indicate that some user event has happened.
-       /*!
-        * Signal is emitted if some user event has happened.
-        */
-       void observedEventDetected();
-       //! Meeting activated.
-       /*!
-        * Signal is emitted when a meeting is clicked by the user.
-        * \param aMeeting actived meeting.
-        */
-       void meetingActivated( Meeting *aMeeting );
-       //! Signals if the shown week has been changed.
-       /*!
-        * Signal. Emitted if the shown week has been changed.
-        * \param aDate The first date of the shown week.
-        */
-       void shownWeekChanged( QDate aDate );
-       //! Signals change of the meeting room.
-       /*!
-        * Signal is emitted when meeting room is changed.
-        * \param aRoom Selected meeting room.
-        */
-       void currentRoomChanged( Room *aRoom );
-       //! Signals when the password dialog buttons are clicked.
-       /*!
-        * Signal is emitted when the password dialog buttons are clicked.
-        * \param aPasswordStatus The status of the password.
-        */
-       void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );
-       //! Signals when the cancel button in the progress bar is clicked.
-       /*!
-        * Signal is emitted when the cancel button in the progress bar is clicked.
-        */
-       void progressBarCancelled();
-       
-public slots:
-       //! Slot for displaying the screensaver (room status view).
-       /*!
-        * Slot. Displays the screensaver.
-        */
-       void showRoomStatus();
-       //! Slot for updating the time.
-       /*!
-        * Slot. Forwards the signal of changed time to current view.
-        * \param aCurrentDateTime Current date and time.
-        */
-       void distributeDateTimeInfo( QDateTime aCurrentDateTime );
-       
-       void updateProgressBar( const QString &aMessage );
-       
-private slots:
-       //! Displays the settings view
-       void showSettingsView();
-
-private:
-       //! Name of the application.
-       QString iApplicationName;
-       //! Defines whether the views should be shown as full screen 
-       bool iFullScreen;
-       //! Pointer to the configuration.
-       Configuration *iConfiguration;
-       //! Pointer to the weekly view.
-       WeeklyViewWidget *iWeeklyView;
-       //! Pointer to the screensaver (room status view).
-       RoomStatusIndicatorWidget *iRoomStatusView;
-       //! Pointer to the meeting info dialog
-       MeetingInfoDialog *iMeetingInfo;
-       //! Pointer to the settings view
-       SettingsView *iSettingsView;
-       //! Pointer to the progress bar
-       ProgressBar *iProgressBar;
-       //! Pointer to the password dialog.
-       PasswordDialog *iPasswordDialog;
-
-};
-
-#endif /*WINDOWMANAGER_H_*/
+#ifndef WINDOWMANAGER_H_\r
+#define WINDOWMANAGER_H_\r
+\r
+#include <QWidget>\r
+#include <QStack>\r
+\r
+// Forward declarations\r
+class ViewBase;\r
+class QEvent;\r
+class QSize;\r
+class QDialog;\r
+class QString;\r
+\r
+//! UserInterface class. Manages displayed views.\r
+/*!\r
+ * UserInterface class. WindowManager class is responsible for displaying views that inherit the\r
+ * ViewBase class. It also handles dialog showing. Depending on the views type the WindowManager\r
+ * can track the views events and restore previous view if the current on is ObservedView. This\r
+ * is a handy mechanism for screensaver etc.\r
+ */\r
+class WindowManager : public QWidget\r
+{\r
+       Q_OBJECT\r
+\r
+public:\r
+       //! Constructor.\r
+       /*!\r
+        * Constructor of WindowManager.\r
+        */\r
+       WindowManager( QWidget *aParent = 0 );\r
+       //! Destructor.\r
+       virtual ~WindowManager();\r
+       \r
+       virtual bool event(QEvent *event);\r
+\r
+signals:\r
+       //! Request current status of the room.\r
+       /*!\r
+        * Signal is emitted when there is need to check current status of room aRoom.\r
+        * \param aRoom Meetingroom which status is requested.\r
+        */\r
+       void eventDetected();\r
+       \r
+       //! The view size is changed.\r
+       /*!\r
+        * This signal is emitted when the window managers view changes,\r
+        * i.e. it received resized QEvent.\r
+        * \param The new view size.\r
+        */\r
+       void viewResized(const QSize &newSize, const QSize &oldSize);\r
+       \r
+       //! Previous view is restored.\r
+       /*!\r
+        * This signal is emitted when previously stored view is\r
+        * restored. This happens when view with type ViewMode::ObservedView\r
+        * is shown and it receives an event that initiates the view\r
+        * restoring chain.\r
+        */\r
+       void previousViewRestored();\r
+       \r
+       void dialogActivated();\r
+       void dialogDeactivated();\r
+\r
+public slots:\r
+       //! Shows the view.\r
+       /*!\r
+        * Show view that inherits ViewBase class. If the views parent is not\r
+        * the WindowManager it will changed within this method. Depeding on the\r
+        * views type the currently active view might be stored and restored\r
+        * when specific event occurs in the view to be displayed.\r
+        */\r
+       void showView( ViewBase *view );\r
+       \r
+       //! Shows modal dialog.\r
+       /*!\r
+        * Shows modal dialog. Emits dialogActivated() signal prior calling\r
+        * QDialog's exec() method and emits dialogDeactivated signal when\r
+        * the exec() method returns.\r
+        */\r
+       void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );\r
+       \r
+       //! View event is detected.\r
+       /*!\r
+        * WindowManager connects this slot to ViewBase classes eventDetected()\r
+        * signal and either emits eventDetected() signal if the current views\r
+        * type is ViewMode::NormalView or restores possible previous view\r
+        * if the current views type is ViewMode::ObservedView.\r
+        */\r
+       void viewEventDetected();\r
+       \r
+       void setFullscreen();\r
+       \r
+       void error( const QString &aErrorMessage );\r
+\r
+private:\r
+       //! Name of the application.\r
+       QString iApplicationName;\r
+       \r
+       //! Currently active view.\r
+       ViewBase *iCurrentView;\r
+       \r
+       //! Stack of views previously displayed.\r
+       QStack<ViewBase *> iViewList;\r
+\r
+};\r
+\r
+#endif /*WINDOWMANAGER_H_*/\r