#ifndef WINDOWMANAGER_H_\r
#define WINDOWMANAGER_H_\r
\r
-#include <QObject>\r
-#include <QTime>\r
-#include "Room.h"\r
-#include "Meeting.h"\r
-#include "PasswordDialog.h"\r
-#include "DeviceManager.h"\r
+#include <QWidget>\r
+#include <QStack>\r
\r
-class QTimer;\r
-class RoomStatusIndicatorWidget;\r
-class WeeklyViewWidget;\r
-class Engine;\r
-class MeetingInfoDialog;\r
-class SettingsView;\r
-class ProgressBar;\r
-class Configuration;\r
+// Forward declarations\r
+class ViewBase;\r
+class QEvent;\r
+class QSize;\r
+class QDialog;\r
+class QString;\r
\r
-//! UserInterface class. Behaves as a proxy between the user interface and application's business logic.\r
+//! UserInterface class. Manages displayed views.\r
/*!\r
- * UserInterface class. Controls the whole user interface, starting with displaying the appropriate\r
- * views. It behaves as a proxy between the user interface and application's business logic, it connects\r
- * the specified components together and forwards the data to the correct place. It also manages the correct\r
- * appearance of current views on the screen.\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 QObject\r
+class WindowManager : public QWidget\r
{\r
Q_OBJECT\r
\r
//! Constructor.\r
/*!\r
* Constructor of WindowManager.\r
- * \param aConfiguration The pointer to configuration.\r
*/\r
- WindowManager( Configuration *aConfiguration );\r
+ WindowManager( QWidget *aParent = 0 );\r
//! Destructor.\r
virtual ~WindowManager();\r
- /*!\r
- * Displays an error message\r
- * \param aErrorMessage Message to be displayd\r
- */\r
- void error( const QString &aErrorMessage );\r
- //! Updates the rooms status.\r
- /*! \r
- * Forwards the signal of changed status to current view.\r
- * \param aRoom Room which status is changed.\r
- * \param aStatus Current status of room.\r
- * \param aTime Time when status is changed.\r
- */\r
- void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime );\r
- //! Shows the password dialog.\r
- /*!\r
- * Shows the password dialog.\r
- * \param aAdminPassword The correct password.\r
- * \param aMessage The message to be shown in the password dialog.\r
- */\r
- void showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage );\r
- //! Displays the weekly view.\r
- /*!\r
- * Displays the weekly view.\r
- */\r
- void showWeeklyView();\r
- //! Displays the meeting info dialog.\r
- /*!\r
- * Displays the meeting info dialog. \r
- * \param aMeeting Meeting to be displayd\r
- */\r
- void showMeetingInfo( Meeting *aMeeting );\r
- //! Returns the pointer to the weekly view. \r
- /*!\r
- * Returns the pointer to the weekly view.\r
- */\r
- WeeklyViewWidget * weeklyView();\r
- //! Switches the views to full screen.\r
- /*!\r
- * Switches the views to full screen.\r
- */\r
- void fullScreen();\r
- \r
- void insertMeeting( Meeting *aMeeting );\r
\r
- void deleteMeeting( Meeting *aMeeting );\r
+ virtual bool event(QEvent *event);\r
\r
signals:\r
//! Request current status of the room.\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 roomStatusInfoNeeded( Room *aRoom );\r
- //! Indicate that some user event has happened.\r
- /*!\r
- * Signal is emitted if some user event has happened.\r
- */\r
- void observedEventDetected();\r
- //! Meeting activated.\r
- /*!\r
- * Signal is emitted when a meeting is clicked by the user.\r
- * \param aMeeting actived meeting.\r
- */\r
- void meetingActivated( Meeting *aMeeting );\r
- //! Signals if the shown week has been changed.\r
+ void eventDetected();\r
+ \r
+ //! The view size is changed.\r
/*!\r
- * Signal. Emitted if the shown week has been changed.\r
- * \param aDate The first date of the shown week.\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 shownWeekChanged( QDate aDate );\r
- //! Signals change of the meeting room.\r
+ void viewResized(const QSize &newSize, const QSize &oldSize);\r
+ \r
+ //! Previous view is restored.\r
/*!\r
- * Signal is emitted when meeting room is changed.\r
- * \param aRoom Selected meeting room.\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 currentRoomChanged( Room *aRoom );\r
+ void previousViewRestored();\r
\r
+ void dialogActivated();\r
+ void dialogDeactivated();\r
+\r
public slots:\r
- //! Slot for displaying the screensaver (room status view).\r
+ //! Shows the view.\r
/*!\r
- * Slot. Displays the screensaver.\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 showRoomStatus();\r
- //! Slot for updating the time.\r
- /*!\r
- * Slot. Forwards the signal of changed time to current view.\r
- * \param aCurrentDateTime Current date and time.\r
- */\r
- void distributeDateTimeInfo( QDateTime aCurrentDateTime );\r
+ void showView( ViewBase *view );\r
\r
-private slots:\r
- //! Displays the settings view\r
- void showSettingsView();\r
- //! Slot for receiving the status of the entered password\r
+ //! Shows modal dialog.\r
/*!\r
- * Slot. Receives the status of the entered password and makes the DeviceManager to change the\r
- * operation mode if the password is correct.\r
- * \param aPasswordStatus The status of the password.\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 passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );\r
- //! Slot for showing/hiding the progress bar.\r
+ void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );\r
+ \r
+ //! View event is detected.\r
/*!\r
- * Slot. Starts showing or hides the progress bar.\r
- * \param aText The text to be shown in progress bar.\r
- * \param aStart to indicate whether the progress bar is wanted to shown or hidden\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 progressBar( const QString &aText = "", bool aStart = false );\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
- //! Pointer to the configuration.\r
- Configuration *iConfiguration;\r
- //! Pointer to the weekly view.\r
- WeeklyViewWidget *iWeeklyView;\r
- //! Pointer to the screensaver (room status view).\r
- RoomStatusIndicatorWidget *iRoomStatusView;\r
- //! Pointer to the meeting info dialog\r
- MeetingInfoDialog *iMeetingInfo;\r
- //! Pointer to the settings view\r
- SettingsView *iSettingsView;\r
- //! Pointer to the progress bar\r
- ProgressBar *iProgressBar;\r
- //! Pointer to the password dialog.\r
- PasswordDialog *iPasswordDialog;\r
+ \r
+ //! Currently active view.\r
+ ViewBase *iCurrentView;\r
+ \r
+ //! Stack of views previously displayed.\r
+ QStack<ViewBase *> iViewList;\r
\r
};\r
\r