From 0707d975553afcef053521d91e8f048992b9f37e Mon Sep 17 00:00:00 2001 From: Mikko Siren Date: Mon, 1 Jun 2009 10:01:10 +0300 Subject: [PATCH] Fixed the room status changing information flow --- src/BusinessLogic/Engine.cpp | 4 ++-- src/BusinessLogic/UIManager.cpp | 2 +- .../Views/RoomStatusIndicatorWidget.cpp | 13 +++++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/BusinessLogic/Engine.cpp b/src/BusinessLogic/Engine.cpp index cc021ca..a07d31e 100644 --- a/src/BusinessLogic/Engine.cpp +++ b/src/BusinessLogic/Engine.cpp @@ -107,7 +107,7 @@ void Engine::checkStatusOfAllRooms() for (int i = 0; i < iConfiguration->rooms().count(); i++) { // and check the status - roomStatusInfoNeeded(iConfiguration->rooms().at(i) ); + roomStatusInfoNeeded( iConfiguration->rooms().at(i) ); } } @@ -354,4 +354,4 @@ void Engine::currentRoomChanged(Room *aRoom) qDebug() << "[Engine::currentRoomChanged] "; iCurrentRoom = aRoom; roomStatusInfoNeeded( iCurrentRoom ); -} \ No newline at end of file +} diff --git a/src/BusinessLogic/UIManager.cpp b/src/BusinessLogic/UIManager.cpp index 2791b15..da3c877 100644 --- a/src/BusinessLogic/UIManager.cpp +++ b/src/BusinessLogic/UIManager.cpp @@ -90,7 +90,7 @@ void UIManager::createSettingsView() void UIManager::createRoomStatusIndicator() { 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( iEngine, SIGNAL( roomStatusChanged( Room::Status, QTime ) ), iRoomStatusIndicator, SLOT( statusChanged( Room::Status, QTime ) ) ); connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iRoomStatusIndicator, SLOT( currentRoomChanged( Room * ) ) ); } diff --git a/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp b/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp index 26dd09b..6daf955 100644 --- a/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp +++ b/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp @@ -76,28 +76,26 @@ QString RoomStatusIndicatorWidget::statusToText( const Room::Status aStatus ) QPalette RoomStatusIndicatorWidget::createPalette( Room::Status aStatus ) { - // QPixmap pixmap( aStatus == Room::BusyStatus ? ":roomstatus_busy" : ":roomstatus_free" ); QString image = aStatus == Room::BusyStatus ? ":roomstatus_busy" : ":roomstatus_free"; + QPixmap pixmap( image ); // The image needs to be moved in normal mode so the traffic light not partly outside the screen const int xoffset( 60 ); const int yoffset( 19 ); -// int cropwidth( pixmap.width() - xoffset ); -// int cropheight( pixmap.height() - yoffset ); + int cropwidth( pixmap.width() - xoffset ); + int cropheight( pixmap.height() - yoffset ); QBrush brush; if ( windowState() == Qt::WindowFullScreen ) { // Use the full image in full screen mode -// brush.setTexture( pixmap ); - brush.setTexture( QPixmap(image) ); + brush.setTexture( pixmap ); } else { // Take part of the image so the traffic lights are moved xoffset poxels to left // and yoffset pixels to up -// brush.setTexture( pixmap.copy( xoffset, yoffset, cropwidth, cropheight ) ); - brush.setTexture( QPixmap(image) ); + brush.setTexture( pixmap.copy( xoffset, yoffset, cropwidth, cropheight ) ); } QPalette palette; @@ -112,7 +110,6 @@ 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 ) { -- 1.7.9.5