From: itkonma Date: Mon, 1 Jun 2009 08:45:36 +0000 (+0300) Subject: Merge branch 'master' of https://git.maemo.org/projects/qtmeetings X-Git-Url: https://vcs.maemo.org/git/?p=qtmeetings;a=commitdiff_plain;h=3c019b17cf2052d8fe5bdfc04a986c520ff409e7 Merge branch 'master' of https://git.maemo.org/projects/qtmeetings Conflicts: src/BusinessLogic/UIManager.h src/UserInterface/Views/RoomStatusIndicatorWidget.cpp --- 3c019b17cf2052d8fe5bdfc04a986c520ff409e7 diff --cc src/UserInterface/Views/RoomStatusIndicatorWidget.cpp index dbc2b07,1cf48a7..a1f75a1 --- a/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp +++ b/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp @@@ -1,147 -1,188 +1,165 @@@ --#include "RoomStatusIndicatorWidget.h" -- --#include --#include --#include --#include "DigitalTimeDisplayWidget.h" --#include "ToolBox.h" -- --#include -- --#include -- --QTime RoomStatusIndicatorWidget::endOfTheDay = QTime( 23, 59, 0, 0 ); -- --RoomStatusIndicatorWidget::RoomStatusIndicatorWidget( Room *aDefaultRoom, Room::Status aStatus, QTime aUntil, QString aTimeFormat, QWidget *aParent ) : -- ViewBase( ViewBase::ObservedView, aParent ), iTimeFormat( aTimeFormat ) --{ -- QFont importantTextFont; -- //importantTextFont.setBold( true ); -- importantTextFont.setPointSize( 20 ); -- -- QFont regularTextFont; -- //regularTextFont.setBold( true ); -- regularTextFont.setPointSize( 12 ); -- -- // display for current time -- // Note: the time display receives current time info from Engine::clock() -- iTimeDisplay = new DigitalTimeDisplayWidget( QTime::currentTime(), iTimeFormat, this ); -- iTimeDisplay->setFrameVisible( false ); -- iTimeDisplay->setSize( 250, 120 ); -- -- // Pegasus -- iDefaultRoomLabel = ToolBox::createLabel( aDefaultRoom->name(), importantTextFont ); -- iDefaultRoomLabel->setAlignment( Qt::AlignHCenter ); -- iDefaultRoomLabel->setStyleSheet( "background-color: transparent" ); - // is busy - iStatusLabel = ToolBox::createLabel( tr( "is %1" ).arg( statusToText( aStatus ) ), importantTextFont ); - iStatusLabel->setAlignment( Qt::AlignHCenter ); - iStatusLabel->setStyleSheet( "background-color: transparent" ); - - // until 13:22 - iUntilTextLabel = ToolBox::createLabel( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ), importantTextFont ); - iUntilTextLabel->setAlignment( Qt::AlignHCenter ); - iUntilTextLabel->setStyleSheet( "background-color: transparent" ); - - QVBoxLayout *topLayout = new QVBoxLayout; - topLayout->addStretch(); - topLayout->addWidget( iTimeDisplay ); - topLayout->addWidget( iDefaultRoomLabel ); - topLayout->addWidget( iStatusLabel ); - topLayout->addWidget( iUntilTextLabel ); - topLayout->addStretch(); - - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->addLayout( topLayout ); - mainLayout->addStretch(); - mainLayout->setMargin( 65 ); - setLayout( mainLayout ); - - statusChanged( aStatus, aUntil ); - - setFocusPolicy( Qt::StrongFocus ); - setEnabled( true ); // enable mouse & key events - } - - RoomStatusIndicatorWidget::~RoomStatusIndicatorWidget() - { - delete iTimeDisplay; - iTimeDisplay = 0; - } - - QString RoomStatusIndicatorWidget::statusToText( const Room::Status aStatus ) - { - return ( aStatus == Room::BusyStatus ) ? tr( "busy" ) : tr( "free" ); - } - - QPalette RoomStatusIndicatorWidget::createPalette( Room::Status aStatus ) - { - // QPixmap pixmap( aStatus == Room::BusyStatus ? ":roomstatus_busy" : ":roomstatus_free" ); - QString image = aStatus == Room::BusyStatus ? ":roomstatus_busy" : ":roomstatus_free"; - - // 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 ); - - QBrush brush; - if ( windowState() == Qt::WindowFullScreen ) - { - // Use the full image in full screen mode - // brush.setTexture( pixmap ); - brush.setTexture( QPixmap(image) ); - } - 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) ); - } - - QPalette palette; - palette.setBrush( QPalette::Window, brush ); - return palette; - } - - void RoomStatusIndicatorWidget::setCurrentTime( QTime aCurrentTime ) - { - iTimeDisplay->setTime( aCurrentTime ); - } - - void RoomStatusIndicatorWidget::statusChanged( const Room::Status aStatus, const QTime aUntil ) - { - iStatusLabel->setText( tr( "is %1" ).arg( statusToText( aStatus ) ) ); - if ( aUntil == RoomStatusIndicatorWidget::endOfTheDay ) - { - iUntilTextLabel->setText( tr( "whole day." ) ); - } - else - { - iUntilTextLabel->setText( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ) ); - } - setPalette( createPalette( aStatus ) ); - iDefaultRoomLabel->setHidden( true ); - - // is busy - iStatusLabel = ToolBox::createLabel( tr( "is %1" ).arg( statusToText( aStatus ) ), importantTextFont ); - iStatusLabel->setAlignment( Qt::AlignHCenter ); - iStatusLabel->setStyleSheet( "background-color: transparent" ); - iStatusLabel->setHidden( true ); - - // until 13:22 - iUntilTextLabel = ToolBox::createLabel( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ), importantTextFont ); - iUntilTextLabel->setAlignment( Qt::AlignHCenter ); - iUntilTextLabel->setStyleSheet( "background-color: transparent" ); - iUntilTextLabel->setHidden( true ); - - // No connection to server note - qDebug() << "RoomStatusIndicatorWidget::RoomStatusIndicatorWidget() creating connection label"; - QFrame* connectionLabelFrame = new QFrame( this ); - iConnectionLabel = new QLabel( tr( "No connection to server" ), connectionLabelFrame ); - iConnectionLabel->setFont( importantTextFont ); - iConnectionLabel->setAlignment( Qt::AlignHCenter ); - iConnectionLabel->setWordWrap( true ); - iConnectionLabel->setStyleSheet( "background-color: transparent; color: red; text-decoration:blink; max-width: 250px" ); - connectionLabelFrame->setFixedSize( iConnectionLabel->sizeHint() ); - if( connectedOnce && !connectionError ) iConnectionLabel->setHidden( true ); - - - QVBoxLayout *topLayout = new QVBoxLayout; - topLayout->addStretch(); - topLayout->addWidget( iTimeDisplay ); - topLayout->addSpacing( 28 ); - topLayout->addWidget( iDefaultRoomLabel ); - topLayout->addWidget( iStatusLabel ); - topLayout->addWidget( iUntilTextLabel ); - topLayout->addSpacing( 28 ); - topLayout->addWidget( connectionLabelFrame ); - topLayout->addStretch(); - - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->addLayout( topLayout ); - mainLayout->addStretch(); - //mainLayout->setMargin( 65 ); - mainLayout->setContentsMargins( 65, 65, 65, 0 ); - setLayout( mainLayout ); - - statusChanged( aStatus, aUntil ); - - setFocusPolicy( Qt::StrongFocus ); - setEnabled( true ); // enable mouse & key events -} - -RoomStatusIndicatorWidget::~RoomStatusIndicatorWidget() -{ - delete iTimeDisplay; - iTimeDisplay = 0; -} - -QString RoomStatusIndicatorWidget::statusToText( const Room::Status aStatus ) -{ - return ( aStatus == Room::BusyStatus ) ? tr( "busy" ) : tr( "free" ); -} - -QPalette RoomStatusIndicatorWidget::createPalette( Room::Status aStatus ) -{ - 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 ); - - QBrush brush; - if ( windowState() == Qt::WindowFullScreen ) - { - // Use the full image in full screen mode - 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 ) ); - } - - QPalette palette; - palette.setBrush( QPalette::Window, brush ); - return palette; -} - -void RoomStatusIndicatorWidget::setCurrentTime( QTime aCurrentTime ) -{ - iTimeDisplay->setTime( aCurrentTime ); -} - -void RoomStatusIndicatorWidget::statusChanged( const Room::Status aStatus, const QTime aUntil ) -{ - iStatusLabel->setText( tr( "is %1" ).arg( statusToText( aStatus ) ) ); - if ( aUntil == RoomStatusIndicatorWidget::endOfTheDay ) - { - iUntilTextLabel->setText( tr( "whole day." ) ); - } - else - { - iUntilTextLabel->setText( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ) ); - } - setPalette( createPalette( aStatus ) ); ++#include "RoomStatusIndicatorWidget.h" ++ ++#include ++#include ++#include ++#include "DigitalTimeDisplayWidget.h" ++#include "ToolBox.h" ++ ++#include ++ ++#include ++ ++QTime RoomStatusIndicatorWidget::endOfTheDay = QTime( 23, 59, 0, 0 ); ++ ++RoomStatusIndicatorWidget::RoomStatusIndicatorWidget( Room *aDefaultRoom, Room::Status aStatus, QTime aUntil, QString aTimeFormat, QWidget *aParent ) : ++ ViewBase( ViewBase::ObservedView, aParent ), iTimeFormat( aTimeFormat ) ++{ ++ QFont importantTextFont; ++ //importantTextFont.setBold( true ); ++ importantTextFont.setPointSize( 20 ); ++ ++ QFont regularTextFont; ++ //regularTextFont.setBold( true ); ++ regularTextFont.setPointSize( 12 ); ++ ++ // display for current time ++ // Note: the time display receives current time info from Engine::clock() ++ iTimeDisplay = new DigitalTimeDisplayWidget( QTime::currentTime(), iTimeFormat, this ); ++ iTimeDisplay->setFrameVisible( false ); ++ iTimeDisplay->setSize( 250, 120 ); ++ ++ // Pegasus ++ iDefaultRoomLabel = ToolBox::createLabel( aDefaultRoom->name(), importantTextFont ); ++ iDefaultRoomLabel->setAlignment( Qt::AlignHCenter ); ++ iDefaultRoomLabel->setStyleSheet( "background-color: transparent" ); ++ iDefaultRoomLabel->setHidden( true ); ++ ++ // is busy ++ iStatusLabel = ToolBox::createLabel( tr( "is %1" ).arg( statusToText( aStatus ) ), importantTextFont ); ++ iStatusLabel->setAlignment( Qt::AlignHCenter ); ++ iStatusLabel->setStyleSheet( "background-color: transparent" ); ++ iStatusLabel->setHidden( true ); ++ ++ // until 13:22 ++ iUntilTextLabel = ToolBox::createLabel( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ), importantTextFont ); ++ iUntilTextLabel->setAlignment( Qt::AlignHCenter ); ++ iUntilTextLabel->setStyleSheet( "background-color: transparent" ); ++ iUntilTextLabel->setHidden( true ); ++ ++ // No connection to server note ++ qDebug() << "RoomStatusIndicatorWidget::RoomStatusIndicatorWidget() creating connection label"; ++ QFrame* connectionLabelFrame = new QFrame( this ); ++ iConnectionLabel = new QLabel( tr( "No connection to server" ), connectionLabelFrame ); ++ iConnectionLabel->setFont( importantTextFont ); ++ iConnectionLabel->setAlignment( Qt::AlignHCenter ); ++ iConnectionLabel->setWordWrap( true ); ++ iConnectionLabel->setStyleSheet( "background-color: transparent; color: red; text-decoration:blink; max-width: 250px" ); ++ connectionLabelFrame->setFixedSize( iConnectionLabel->sizeHint() ); ++ if( connectedOnce && !connectionError ) iConnectionLabel->setHidden( true ); ++ ++ ++ QVBoxLayout *topLayout = new QVBoxLayout; ++ topLayout->addStretch(); ++ topLayout->addWidget( iTimeDisplay ); ++ topLayout->addSpacing( 28 ); ++ topLayout->addWidget( iDefaultRoomLabel ); ++ topLayout->addWidget( iStatusLabel ); ++ topLayout->addWidget( iUntilTextLabel ); ++ topLayout->addSpacing( 28 ); ++ topLayout->addWidget( connectionLabelFrame ); ++ topLayout->addStretch(); ++ ++ QHBoxLayout *mainLayout = new QHBoxLayout; ++ mainLayout->addLayout( topLayout ); ++ mainLayout->addStretch(); ++ //mainLayout->setMargin( 65 ); ++ mainLayout->setContentsMargins( 65, 65, 65, 0 ); ++ setLayout( mainLayout ); ++ ++ statusChanged( aStatus, aUntil ); ++ ++ setFocusPolicy( Qt::StrongFocus ); ++ setEnabled( true ); // enable mouse & key events ++} ++ ++RoomStatusIndicatorWidget::~RoomStatusIndicatorWidget() ++{ ++ delete iTimeDisplay; ++ iTimeDisplay = 0; ++} ++ ++QString RoomStatusIndicatorWidget::statusToText( const Room::Status aStatus ) ++{ ++ return ( aStatus == Room::BusyStatus ) ? tr( "busy" ) : tr( "free" ); ++} ++ ++QPalette RoomStatusIndicatorWidget::createPalette( Room::Status aStatus ) ++{ ++ 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 ); ++ ++ QBrush brush; ++ if ( windowState() == Qt::WindowFullScreen ) ++ { ++ // Use the full image in full screen mode ++ 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 ) ); ++ } ++ ++ QPalette palette; ++ palette.setBrush( QPalette::Window, brush ); ++ return palette; ++} ++ ++void RoomStatusIndicatorWidget::setCurrentTime( QTime aCurrentTime ) ++{ ++ iTimeDisplay->setTime( aCurrentTime ); ++} ++ ++void RoomStatusIndicatorWidget::statusChanged( const Room::Status aStatus, const QTime aUntil ) ++{ ++ iStatusLabel->setText( tr( "is %1" ).arg( statusToText( aStatus ) ) ); ++ if ( aUntil == RoomStatusIndicatorWidget::endOfTheDay ) ++ { ++ iUntilTextLabel->setText( tr( "whole day." ) ); ++ } ++ else ++ { ++ iUntilTextLabel->setText( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ) ); ++ } ++ setPalette( createPalette( aStatus ) ); ++} ++ ++void RoomStatusIndicatorWidget::currentRoomChanged( Room *aRoom ) ++{ ++ iDefaultRoomLabel->setText( aRoom->name() ); ++} ++ ++bool RoomStatusIndicatorWidget::event(QEvent *event) ++{ ++ switch(event->type()) ++ { ++ case QEvent::Paint: ++ qDebug() << "[RoomStatusIndicatorWidget::event] "; ++ break; ++ case QEvent::PaletteChange: ++ qDebug() << "[RoomStatusIndicatorWidget::event] "; ++ break; ++ default: ++ break; ++ } ++ ++ return ViewBase::event( event ); } -- --void RoomStatusIndicatorWidget::currentRoomChanged( Room *aRoom ) --{ -- iDefaultRoomLabel->setText( aRoom->name() ); --} -- --bool RoomStatusIndicatorWidget::event(QEvent *event) --{ -- switch(event->type()) -- { -- case QEvent::Paint: -- qDebug() << "[RoomStatusIndicatorWidget::event] "; -- break; -- case QEvent::PaletteChange: -- qDebug() << "[RoomStatusIndicatorWidget::event] "; -- break; -- default: -- break; -- } -- -- return ViewBase::event( event ); --} - -void RoomStatusIndicatorWidget::connectionEstablished() -{ - - if( !connectedOnce ) - { - // Just got the required meetings for the first time - qDebug() << "RoomStatusIndicatorWidget::connectionEstablished() first call"; - iDefaultRoomLabel->setHidden( false ); - iUntilTextLabel->setHidden( false ); - iStatusLabel->setHidden( false ); - } - else qDebug() << "RoomStatusIndicatorWidget::connectionEstablished()"; - ViewBase::connectionEstablished(); - iConnectionLabel->setHidden( true ); -} - -void RoomStatusIndicatorWidget::connectionLost() -{ - ViewBase::connectionLost(); - iConnectionLabel->setHidden( false ); -} -