Merge branch 'master' into dev_local
[qtmeetings] / src / UserInterface / Views / RoomStatusIndicatorWidget.cpp
index 26dd09b..89f65f1 100644 (file)
@@ -33,28 +33,48 @@ RoomStatusIndicatorWidget::RoomStatusIndicatorWidget( Room *aDefaultRoom, Room::
        iDefaultRoomLabel = ToolBox::createLabel( aDefaultRoom->name(), importantTextFont );\r
        iDefaultRoomLabel->setAlignment( Qt::AlignHCenter );\r
        iDefaultRoomLabel->setStyleSheet( "background-color: transparent" );\r
+       iDefaultRoomLabel->setHidden( true );\r
+       \r
        // is busy\r
        iStatusLabel = ToolBox::createLabel( tr( "is %1" ).arg( statusToText( aStatus ) ), importantTextFont );\r
        iStatusLabel->setAlignment( Qt::AlignHCenter );\r
        iStatusLabel->setStyleSheet( "background-color: transparent" );\r
+       iStatusLabel->setHidden( true );\r
 \r
        // until 13:22\r
        iUntilTextLabel = ToolBox::createLabel( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ), importantTextFont );\r
        iUntilTextLabel->setAlignment( Qt::AlignHCenter );\r
        iUntilTextLabel->setStyleSheet( "background-color: transparent" );\r
+       iUntilTextLabel->setHidden( true );\r
+       \r
+       // No connection to server note\r
+       qDebug() << "RoomStatusIndicatorWidget::RoomStatusIndicatorWidget() creating connection label";\r
+       QFrame* connectionLabelFrame = new QFrame( this );\r
+       iConnectionLabel = new QLabel( tr( "No connection to server" ), connectionLabelFrame );\r
+       iConnectionLabel->setFont( importantTextFont ); \r
+       iConnectionLabel->setAlignment( Qt::AlignHCenter );\r
+       iConnectionLabel->setWordWrap( true );\r
+       iConnectionLabel->setStyleSheet( "background-color: transparent; color: red; text-decoration:blink; max-width: 250px" );\r
+       connectionLabelFrame->setFixedSize( iConnectionLabel->sizeHint() );\r
+       if( connectedOnce && !connectionError ) iConnectionLabel->setHidden( true );\r
+               \r
 \r
        QVBoxLayout *topLayout = new QVBoxLayout;\r
        topLayout->addStretch();\r
        topLayout->addWidget( iTimeDisplay );\r
+       topLayout->addSpacing( 28 );\r
        topLayout->addWidget( iDefaultRoomLabel );\r
        topLayout->addWidget( iStatusLabel );\r
        topLayout->addWidget( iUntilTextLabel );\r
+       topLayout->addSpacing( 28 );\r
+       topLayout->addWidget( connectionLabelFrame );\r
        topLayout->addStretch();\r
 \r
        QHBoxLayout *mainLayout = new QHBoxLayout;\r
        mainLayout->addLayout( topLayout );\r
        mainLayout->addStretch();\r
-       mainLayout->setMargin( 65 );\r
+       //mainLayout->setMargin( 65 );\r
+       mainLayout->setContentsMargins( 65, 65, 65, 0 );\r
        setLayout( mainLayout );\r
 \r
        statusChanged( aStatus, aUntil );\r
@@ -146,3 +166,26 @@ bool RoomStatusIndicatorWidget::event(QEvent *event)
        \r
        return ViewBase::event( event );\r
 }\r
+\r
+void RoomStatusIndicatorWidget::connectionEstablished()\r
+{\r
+       \r
+       if( !connectedOnce )\r
+       {\r
+               // Just got the required meetings for the first time\r
+               qDebug() << "RoomStatusIndicatorWidget::connectionEstablished() first call";\r
+               iDefaultRoomLabel->setHidden( false );\r
+               iUntilTextLabel->setHidden( false );\r
+               iStatusLabel->setHidden( false );\r
+       }\r
+       else qDebug() << "RoomStatusIndicatorWidget::connectionEstablished()";\r
+       ViewBase::connectionEstablished();\r
+       iConnectionLabel->setHidden( true );\r
+}\r
+\r
+void RoomStatusIndicatorWidget::connectionLost()\r
+{\r
+       ViewBase::connectionLost();\r
+       iConnectionLabel->setHidden( false );\r
+}\r
+\r