X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2FBusinessLogic%2FEngine.h;h=65690a1a9e9bec61ef4b8d34260584f609efb5ba;hb=51d64b3d9f4cacc447c74e5811e692fbe9b4137f;hp=4695738d4b3c730bf8fa3319b648877def6d041d;hpb=e6424950847505ac767d517f17df7830ad34b2ea;p=qtmeetings diff --git a/src/BusinessLogic/Engine.h b/src/BusinessLogic/Engine.h index 4695738..65690a1 100644 --- a/src/BusinessLogic/Engine.h +++ b/src/BusinessLogic/Engine.h @@ -13,12 +13,7 @@ class Clock; class Configuration; class CommunicationManager; class Meeting; -// class DeviceManager; -class WeeklyViewWidget; -class SettingsView; -class RoomStatusIndicatorWidget; -class PasswordDialog; -class MeetingInfoDialog; +class UIManager; //! BusinessLogic class. Contains all the business logic of the application. /*! @@ -44,9 +39,13 @@ public: */ Room* defaultRoom(); + bool connected(); + QTime lastUpdated(); + QString errorMessage(); + signals: - void meetingDetailsFetched( Meeting *aDetailedMeeting ); + void roomStatusChanged( Room::Status aStatus, QTime aUntil ); private slots: //! Slot. Closes the application. @@ -65,12 +64,6 @@ private slots: * Slot. Asks the communication to fetch new meeting data. * \param aCurrentRoom The current room. */ - void currentRoomChanged( Room *aCurrentRoom ); - //! Slot. Asks the communication to fetch new meeting data. - /*! - * Slot. Asks the communication to fetch new meeting data. - * \param aCurrentRoom The current room. - */ void shownWeekChanged( QDate aDate ); //! Slot. Handles errors. /*! @@ -80,12 +73,6 @@ private slots: * \param aAddInfo Possible addition info. */ void errorHandler( int aCode, const QString &aAddInfo = "" ); - //! Slot. Fetches meetings from the server. - /*! - * Slot. Fetches meetings from the server. Parameters are hard coded: the meetings of the default - * room from current and +/- 2 weeks are fetched. - */ - void fetchMeetings(); //! Slot. Saves fetched meetings to the current instance's local storage. /*! * Slot. Saves fetched meetings to the current instance's local storage. Meetings are soted in a @@ -94,47 +81,26 @@ private slots: * \param aMeetings The list of freshly fetched meetings. */ void meetingsFetched( const QList& ); - - void meetingDetailsFetched( Meeting &aDetailedMeeting ); - //! Slot. Checks the availability of all the rooms. /*! * Slot. Checks the availability of all the rooms by iterating through the current object's local * room storage and calling the roomStatusInfoNeeded() separately on each of them. */ void checkStatusOfAllRooms(); - //! Slot for popping up the confirmation dialog to change the current operation mode + //! Slot for receiving the failure event of operation mode changing. /*! - * Slot. Asks Window manager to pop up a confirmation dialog. - * \param aMode The operation mode to be changed to + * Slot. Receives the failure event of operation mode changing. */ - void changeModeOrdered( DeviceManager::OperationMode aMode ); - //! Slot. Fetches meeting details from the server. - /*! - * Slot. Fetches meeting details from the server. - * \param aMeeting The meeting. - */ - void fetchMeetingDetails( Meeting *aMeeting ); - //! Slot for receiving the status of the entered password - /*! - * Slot. Receives the status of the entered password and makes the DeviceManager to change the - * operation mode if the password is correct. - * \param aPasswordStatus The status of the password. - */ - void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus ); + void changeModeFailed(); //! Slot for receiving the cancel event of the progress bar. /*! - * Slot. Receives the cancel event of the progress bar. + * Receives the cancel event of the progress bar when meeting details requested. */ - void progressBarCancelled(); + void fetchMeetingDetails( Meeting *aMeeting ); + void cancelFetchMeetingDetails(); void handleViewEvent(); void previousViewRestored(); - void settingsViewRequested(); - - void idleTimerTimeout(); - - void settingsOkClicked(); //! Slot for dialog activation signal. /*! @@ -151,7 +117,28 @@ private slots: */ void dialogDeactivated(); + void stopIdleTimeCounter(); + void startIdleTimeCounter(); + + void changeDeviceMode(); + + void currentRoomChanged( Room *aRoom ); + + void tick( QDateTime aCurrentDateTime ); + + /** + * Updates the current rooms info. + */ + void updateRoomInfo(); + /** + * + */ + void configurationChanged(); + private: + // Make the UIManager as friendly class so it can connect to private slots. + friend class UIManager; + //! Provides the index of the Meeting instance which is at the specified time. /*! * Provides the index of the Meeting instance which is at the specified time. If there are @@ -170,22 +157,14 @@ private: * \return Index of the meeting if found; otherwise, -1. */ int indexOfMeetingAfter( Room *aRoom, QDateTime aAfter ); - //! Indicates if the QList contains the Meeting or not. - /*! - * Indicates if the QList contains the Meeting or not. - * \param aList List of meetings. - * \param aMeeting The meeting which is seeked in the list for. - * \return True if contains; otherwise, false. - */ - static bool isMeetingInList( const QList &aList, const Meeting *aMeeting ); //! Slot. Fetches meetings from the server. /*! * Slot. Fetches meetings from the server, exact parameters are specified in the parameter list. - * \param aFrom Time from when the meetings need to be fetched. - * \param aUntil Time until when the meetings need to be fetched. + * \param aWeek Week for which the meetings need to be fetched. + * \param aYear Year for which the meetings need to be fetched. * \param aIn The room which meetings need to be fetched. */ - void fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn ); + void fetchMeetings( const int aWeek, const int aYear, const Room *aIn ); //! Initialize configuration package. /*! * This method initializes configuration classes and @@ -218,27 +197,29 @@ private: * packages are connected here. */ void connectSignals(); + + bool isMeetingInList(const QList &aList, const Meeting *aMeeting); private: static QTime endOfTheDay; - - WindowManager *iWindowManager; - WeeklyViewWidget *iWeeklyView; - SettingsView *iSettingsView; - RoomStatusIndicatorWidget *iRoomStatusIndicator; - - PasswordDialog *iPasswordDialog; - MeetingInfoDialog *iMeetingInfoDialog; QTimer *iIdleTimeCounter; Clock *iClock; + QDate iCurrentDate; Configuration *iConfiguration; CommunicationManager *iCommunication; + WindowManager *iWindowManager; DeviceManager *iDevice; + UIManager *iUIManager; QTimer *iAutoRefresh; QList iMeetings; + + Room *iCurrentRoom; + bool iCommunicationFailed; + QString iCommunicationError; + QTime iLastCommunication; }; #endif /*ENGINE_H_*/