Merge branch 'master' of https://git.maemo.org/projects/qtmeetings
authorMikko Siren <mikko.siren@ixonos.com>
Thu, 28 May 2009 13:05:21 +0000 (16:05 +0300)
committerMikko Siren <mikko.siren@ixonos.com>
Thu, 28 May 2009 13:05:21 +0000 (16:05 +0300)
src/BusinessLogic/Engine.cpp
src/BusinessLogic/Engine.h
src/BusinessLogic/UIManager.cpp
src/UserInterface/Views/RoomStatusIndicatorWidget.cpp
src/UserInterface/Views/RoomStatusIndicatorWidget.h

index 89fe7de..d336a3a 100644 (file)
@@ -16,7 +16,7 @@
 #include <QtDebug>
 
 QTime Engine::endOfTheDay = QTime( 23, 59, 0, 0); // end of the day is 11:59pm
-const int IDLE_TIME_MULTIPLIER = 60000; // Multiplies milliseconds to minutes
+const int IDLE_TIME_MULTIPLIER = 5000; // Multiplies milliseconds to minutes
 
 // Macro to help deleting objects. This could be global.
 #define QT_DELETE(X) \
@@ -164,31 +164,15 @@ void Engine::roomStatusInfoNeeded(Room *aRoom)
        ( ( indexOfNextMeeting != -1 ) ? iMeetings.at( indexOfNextMeeting )->startsAt().time() : Engine::endOfTheDay );
 
        //currently works only for deafult room
-//     if( aRoom->equals( *(defaultRoom() ) ) )
-//             iWindowManager->roomStatusChanged( aRoom, status, until );
-}
-
-/*
-void Engine::fetchMeetings()
-{
-       qDebug() << "Engine::fetchMeetings for " << iCurrentRoom;
-       QDateTime from( iWindowManager->weeklyView()->beginnigOfShownWeek() );
-       QDateTime to( from.addDays( 7 ) );
-       // fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
-       // Signal is connected to the currentRoomChanged slot which keeps the iCurrentRoom up to date
-       fetchMeetings( from, to, iCurrentRoom );
+       if ( aRoom->equals( *(iCurrentRoom) ) )
+       {
+               emit roomStatusChanged( status, until );
+       }
 }
-*/
 
 void Engine::fetchMeetingDetails( Meeting *aMeeting )
 {
        qDebug() << "Engine::fetchMeetingDetails( Meeting* )";
-/*     iWindowManager->showProgressBar(tr("Please Wait"), true);
-       iWindowManager->updateProgressBar(tr("Fetching Meeting Details...") );
-       connect(iWindowManager, 
-       SIGNAL( progressBarCancelled() ), this, 
-       SLOT( fetchMeetingDetailsCancelled() ));
-       iCommunication->fetchMeetingDetails( *aMeeting); */
        iCommunication->fetchMeetingDetails( *aMeeting );
 }
 
@@ -269,7 +253,7 @@ void Engine::initUserInterface()
        connect( iWindowManager, SIGNAL( eventDetected() ), this, SLOT( handleViewEvent() ) );
        connect( iWindowManager, SIGNAL( previousViewRestored() ), iUIManager, SLOT( previousViewRestored() ) );
 //     connect( iWindowManager, SIGNAL( dialogActivated() ), this, SLOT( dialogActivated() ) );
-//     connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) );
+       connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) );
        
        // Show the UI
        iWindowManager->setWindowState( Qt::WindowMaximized );
index 99992dd..b6bd8dd 100644 (file)
@@ -17,8 +17,10 @@ class UIManager;
 
 //! BusinessLogic class. Contains all the business logic of the application.
 /*!
- * BusinessLogic class. Contains all the business logic of the application. It is responsible
- * for connecting user interface to lower application layers (IO).
+ * BusinessLogic class. Contains all the business logic of the application. This class handles
+ * the logic of the application according received calls to the slots. This class also maintains
+ * the instances of managers, timers and its own set of meeting list. The managers handles
+ * their tasks in more detailed manner.
  */
 class Engine : public QObject
 {
@@ -41,6 +43,8 @@ public:
 
 signals:
 
+       void roomStatusChanged( Room::Status aStatus, QTime aUntil );
+
 private slots:
        //! Slot. Closes the application.
        /*!
@@ -67,12 +71,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
index be2f660..517a715 100644 (file)
@@ -89,7 +89,11 @@ void UIManager::createSettingsView()
 
 void UIManager::createRoomStatusIndicator()
 {
-       iRoomStatusIndicator = new RoomStatusIndicatorWidget( iEngine->defaultRoom(), Room::FreeStatus, QTime::currentTime(), iEngine->iConfiguration->displaySettings()->dateFormat() );
+       iRoomStatusIndicator = new RoomStatusIndicatorWidget( iEngine->defaultRoom(), Room::FreeStatus, QTime::currentTime().addSecs(100000000), iEngine->iConfiguration->displaySettings()->timeFormat() );
+       
+       // Connect engine signals
+       connect( iEngine, SIGNAL( roomStatusChanged( Room::Status, QTime ) ), iRoomStatusIndicator, SLOT( statusChanged( Room::Status, QTime ) ) );
+       connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iRoomStatusIndicator, SLOT( currentRoomChanged( Room * ) ) );
 }
 
 void UIManager::createPasswordDialog()
@@ -179,8 +183,10 @@ void UIManager::meetingDetailsFetched(Meeting &aDetailedMeeting)
                {
                        iProgressBar->close(); // Close it in case it's visible
                }
+               iEngine->stopIdleTimeCounter(); // Timer restarted when the dialog is dismissed.
                MeetingInfoDialog *tmp = new MeetingInfoDialog( &aDetailedMeeting );
                iWindowManager->showDialog( static_cast<QDialog *>( tmp ) );
+               
 // TODO : We should use the member variable and implement correctly the setMeeting() method !!!
 //             iMeetingInfo->setMeeting( &aDetailedMeeting );
 //             iWindowManager->showDialog( static_cast<QDialog *>( iMeetingInfo ) );
@@ -240,6 +246,10 @@ void UIManager::updateTime(QDateTime aDateTime)
        {
                iWeeklyView->setCurrentDateTime( aDateTime );
        }
+       if ( iRoomStatusIndicator != 0 )
+       {
+               iRoomStatusIndicator->setCurrentTime( aDateTime.time() );
+       }
 }
 
 void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus )
index c903bc0..694663e 100644 (file)
@@ -13,6 +13,7 @@ QTime RoomStatusIndicatorWidget::endOfTheDay = QTime( 23, 59, 0, 0 );
 RoomStatusIndicatorWidget::RoomStatusIndicatorWidget( Room *aDefaultRoom, Room::Status aStatus, QTime aUntil, QString aTimeFormat, QWidget *aParent ) :\r
                ViewBase( ViewBase::ObservedView, aParent ), iTimeFormat( aTimeFormat )\r
 {\r
+       \r
        QFont importantTextFont;\r
        //importantTextFont.setBold( true );\r
        importantTextFont.setPointSize( 20 );\r
@@ -118,3 +119,8 @@ void RoomStatusIndicatorWidget::statusChanged( const Room::Status aStatus, const
        }\r
        setPalette( createPalette( aStatus ) );\r
 }\r
+\r
+void RoomStatusIndicatorWidget::currentRoomChanged( Room *aRoom )\r
+{\r
+       iDefaultRoomLabel->setText( aRoom->name() );\r
+}\r
index c20ce45..47c73fa 100644 (file)
@@ -55,6 +55,12 @@ public slots:
         * \param aUntil The new time until the specified status is valid.\r
         */\r
        void statusChanged( const Room::Status aStatus, const QTime aUntil );\r
+       //! Changed the current room.\r
+       /*!\r
+        * This slot is used to inform that current room is changed and it changes\r
+        * the room name label.\r
+        */\r
+       void currentRoomChanged( Room *aRoom );\r
        \r
        void viewResized(const QSize &newSize, const QSize &oldSize) { }\r
 \r