From 91a6320c32433fd05bd20ba09dfd48548e6d2ade Mon Sep 17 00:00:00 2001 From: Mikko Siren Date: Mon, 1 Jun 2009 09:35:48 +0300 Subject: [PATCH] Fixed errors caused by auto merge that did not work correctly --- src/BusinessLogic/Engine.cpp | 30 +++++--------------- src/BusinessLogic/Engine.h | 8 ++---- src/BusinessLogic/UIManager.cpp | 8 +++++- .../Views/RoomStatusIndicatorWidget.cpp | 1 + .../Views/RoomStatusIndicatorWidget.h | 2 ++ 5 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/BusinessLogic/Engine.cpp b/src/BusinessLogic/Engine.cpp index 962da10..cc021ca 100644 --- a/src/BusinessLogic/Engine.cpp +++ b/src/BusinessLogic/Engine.cpp @@ -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 ); } @@ -207,7 +191,7 @@ void Engine::meetingsFetched( const QList &aMeetings ) } // refresh room status info - roomStatusInfoNeeded( defaultRoom() ); + roomStatusInfoNeeded( iCurrentRoom /*defaultRoom()*/ ); } void Engine::errorHandler( int aCode, const QString &aAddInfo ) @@ -236,8 +220,7 @@ void Engine::shownWeekChanged( QDate aFrom ) QDateTime from( aFrom ); QDateTime to( aFrom.addDays( 7 ), QTime( 23, 59 ) ); qDebug() << "[Engine::shownWeekChanged] "; - iCommunication->fetchMeetings( from, to, *defaultRoom() ); -// fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() ); + iCommunication->fetchMeetings( from, to, *iCurrentRoom/*defaultRoom()*/ ); } void Engine::changeDeviceMode() @@ -370,4 +353,5 @@ void Engine::currentRoomChanged(Room *aRoom) { qDebug() << "[Engine::currentRoomChanged] "; iCurrentRoom = aRoom; + roomStatusInfoNeeded( iCurrentRoom ); } \ No newline at end of file diff --git a/src/BusinessLogic/Engine.h b/src/BusinessLogic/Engine.h index dc538ec..50e5135 100644 --- a/src/BusinessLogic/Engine.h +++ b/src/BusinessLogic/Engine.h @@ -41,6 +41,8 @@ public: signals: + void roomStatusChanged( Room::Status aStatus, QTime aUntil ); + private slots: //! Slot. Closes the application. /*! @@ -67,12 +69,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 diff --git a/src/BusinessLogic/UIManager.cpp b/src/BusinessLogic/UIManager.cpp index 7d697e8..2791b15 100644 --- a/src/BusinessLogic/UIManager.cpp +++ b/src/BusinessLogic/UIManager.cpp @@ -89,7 +89,9 @@ 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(), iEngine->iConfiguration->displaySettings()->timeFormat() ); + connect( iEngine, SIGNAL( roomStatusChanged( Room::Status, QTime ) ), this, SLOT( statusChanged( Room::Status, QTime ) ) ); + connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iRoomStatusIndicator, SLOT( currentRoomChanged( Room * ) ) ); } void UIManager::createPasswordDialog() @@ -237,6 +239,10 @@ void UIManager::updateTime(QDateTime aDateTime) { iWeeklyView->setCurrentDateTime( aDateTime ); } + if ( iRoomStatusIndicator != 0 ) + { + iRoomStatusIndicator->setCurrentTime( aDateTime.time() ); + } } void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus ) diff --git a/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp b/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp index dbc2b07..26dd09b 100644 --- a/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp +++ b/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp @@ -112,6 +112,7 @@ void RoomStatusIndicatorWidget::setCurrentTime( QTime aCurrentTime ) void RoomStatusIndicatorWidget::statusChanged( const Room::Status aStatus, const QTime aUntil ) { + qDebug() << "[RoomStatusIndicatorWidget::statusChanged] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; iStatusLabel->setText( tr( "is %1" ).arg( statusToText( aStatus ) ) ); if ( aUntil == RoomStatusIndicatorWidget::endOfTheDay ) { diff --git a/src/UserInterface/Views/RoomStatusIndicatorWidget.h b/src/UserInterface/Views/RoomStatusIndicatorWidget.h index 67d40dc..73957b6 100644 --- a/src/UserInterface/Views/RoomStatusIndicatorWidget.h +++ b/src/UserInterface/Views/RoomStatusIndicatorWidget.h @@ -60,6 +60,8 @@ public slots: */ void statusChanged( const Room::Status aStatus, const QTime aUntil ); + void currentRoomChanged( Room *aRoom ); + void viewResized(const QSize &newSize, const QSize &oldSize) { } private: -- 1.7.9.5