-#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
-\r
-class QTimer;\r
-class RoomStatusIndicatorWidget;\r
-class WeeklyViewWidget;\r
-class Engine;\r
-class MeetingInfoDialog;\r
-class SettingsView;\r
-\r
-//! UserInterface class. Behaves as a proxy between the user interface and application's business logic.\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
- */\r
-class WindowManager : public QObject\r
-{\r
- Q_OBJECT\r
-\r
-public:\r
- //! Constructor.\r
- /*!\r
- * Constructor of WindowManager.\r
- */\r
- WindowManager();\r
- //! Destructor.\r
- virtual ~WindowManager();\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 roomStatusInfoNeeded( Room *aRoom );\r
-\r
-private slots:\r
- //! Closes the application.\r
- void closeApplication();\r
- //! Updates the time.\r
- /*!\r
- * Forwards the signal of changed time to current view.\r
- * \param aCurrentDateTime Current date and time.\r
- */\r
- void distributeDateTimeInfo( QDateTime aCurrentDateTime );\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
- //! Displays the weekly view\r
- void showWeeklyView();\r
- //! Displays the screensaver (room status view)\r
- void showRoomStatus();\r
- //! Displays the settings view\r
- void showSettingsView();\r
- /*!\r
- * Displays the meeting info dialog\r
- * \param aMeeting Meeting to be displayd\r
- */\r
- void showMeetingInfo( Meeting *aMeeting );\r
- /*!\r
- * Displays an error message\r
- * \param aErrorMessage Message to be displayd\r
- */\r
- void error( const QString &aErrorMessage );\r
- //! Restarts the timer to launch the screensaver.\r
- void observedEventDetected();\r
- //! Slot for fetching meetings.\r
- /*!\r
- * Slot. Fetches meetings for room aRoom for currently visible week\r
- * \param aRoom\r
- */\r
- void fetchMeetings( Room *aRoom );\r
- //! Slot for fetching meetings.\r
- /*!\r
- * Slot. Fetches meetings for current room from date aFrom to week ahead.\r
- * \param aFrom Date where to begin fetching\r
- */\r
- void fetchMeetings( QDate aFrom );\r
- //! Slot for popping up the confirmation dialog to change the current operation mode\r
- /*!\r
- * Slot. Asks PopUpMessageBox to pop up a confirmation dialog.\r
- * \param aMode The operation mode to be changed to\r
- */\r
- void changeModeOrdered( DeviceManager::OperationMode aMode );\r
- //! Slot for receiving the status of the entered password\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
- */\r
- void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );\r
-\r
-private:\r
- //! Name of the application.\r
- QString iApplicationName;\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 engine.\r
- Engine *iEngine;\r
- //! Timer to launch the screensaver widget\r
- QTimer *iIdleTimeCounter;\r
- //! Pointer to the settings view\r
- SettingsView *iSettingsView;\r
-\r
-};\r
-\r
-#endif /*WINDOWMANAGER_H_*/\r
+#ifndef WINDOWMANAGER_H_
+#define WINDOWMANAGER_H_
+
+#include <QMainWindow>
+#include <QStack>
+
+// Forward declarations
+class ViewBase;
+class QEvent;
+class QSize;
+class QDialog;
+class QString;
+
+//! UserInterface class. Manages displayed views.
+/*!
+ * UserInterface class. WindowManager class is responsible for displaying views that inherit the
+ * ViewBase class. It also handles dialog showing. Depending on the views type the WindowManager
+ * can track the views events and restore previous view if the current on is ObservedView. This
+ * is a handy mechanism for screensaver etc.
+ */
+class WindowManager : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ //! Constructor.
+ /*!
+ * Constructor of WindowManager.
+ */
+ WindowManager( QWidget *aParent = 0 );
+ //! Destructor.
+ virtual ~WindowManager();
+
+ virtual bool event(QEvent *event);
+
+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 eventDetected();
+
+ //! The view size is changed.
+ /*!
+ * This signal is emitted when the window managers view changes,
+ * i.e. it received resized QEvent.
+ * \param The new view size.
+ */
+ void viewResized(const QSize &newSize, const QSize &oldSize);
+
+ //! Previous view is restored.
+ /*!
+ * This signal is emitted when previously stored view is
+ * restored. This happens when view with type ViewMode::ObservedView
+ * is shown and it receives an event that initiates the view
+ * restoring chain.
+ */
+ void previousViewRestored();
+
+ void showSettingsClicked();
+
+ void closeClicked();
+
+ void dialogActivated();
+ void dialogDeactivated();
+
+public slots:
+ //! Shows the view.
+ /*!
+ * Show view that inherits ViewBase class. If the views parent is not
+ * the WindowManager it will changed within this method. Depeding on the
+ * views type the currently active view might be stored and restored
+ * when specific event occurs in the view to be displayed.
+ */
+ void showView( ViewBase *view );
+
+ //! Shows modal dialog.
+ /*!
+ * Shows modal dialog. Emits dialogActivated() signal prior calling
+ * QDialog's exec() method and emits dialogDeactivated signal when
+ * the exec() method returns.
+ */
+ void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );
+
+ //! View event is detected.
+ /*!
+ * WindowManager connects this slot to ViewBase classes eventDetected()
+ * signal and either emits eventDetected() signal if the current views
+ * type is ViewMode::NormalView or restores possible previous view
+ * if the current views type is ViewMode::ObservedView.
+ */
+ void viewEventDetected();
+
+ void setFullscreen();
+
+ void error( const QString &aErrorMessage );
+
+private:
+ //! Name of the application.
+ QString iApplicationName;
+
+ //! Currently active view.
+ ViewBase *iCurrentView;
+
+ //! Stack of views previously displayed.
+ QStack<ViewBase *> iViewList;
+
+ //! Menu settings
+ QAction *settingsAction;
+ //! Menu close application
+ QAction *closeAction;
+ //! Edit menu
+ QMenu *editMenu;
+};
+
+#endif /*WINDOWMANAGER_H_*/