User interface update
[qtmeetings] / src / UserInterface / Views / RoomStatusIndicatorWidget.cpp
index ebe2a90..ca53b9d 100644 (file)
@@ -3,7 +3,8 @@
 #include <QLabel>
 #include <QFont>
 #include <QVBoxLayout>
-#include "DigitalTimeDisplayWidget.h"
+#include "BorderedBarWidget.h"
+
 #include "ToolBox.h"
 
 #include <QEvent>
@@ -15,68 +16,80 @@ 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 clockFont;
+       clockFont.setStyleHint( QFont::Helvetica );
+       clockFont.setBold( true );
+       clockFont.setPixelSize( 36 );
+
+       QFont textFont;
+       textFont.setStyleHint( QFont::Helvetica );
+       textFont.setBold( true );
+       textFont.setPixelSize( 48 );
 
-       QFont regularTextFont;
-       //regularTextFont.setBold( true );
-       regularTextFont.setPointSize( 12);
+       QFont statusBarFont;
+       statusBarFont.setStyleHint( QFont::Helvetica );
+       statusBarFont.setPixelSize( 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);
+       iTimeDisplay = new BorderedBarWidget( this );
+       iTimeDisplay->setFaceColor( Qt::darkGray );
+       iTimeDisplay->setBackgroundColor( Qt::white );
+       iTimeDisplay->setBorderWidth( 6 );
+       iTimeDisplay->setFixedWidth( 170 );
+       iTimeDisplay->setFixedHeight( 50 );
+       iTimeDisplay->setFont( clockFont );
+
+       iStatusBar = new BorderedBarWidget( this );
+       iStatusBar->setFaceColor( Qt::darkGray );
+       iStatusBar->setBackgroundColor( Qt::white );
+       iStatusBar->setBorderWidth( 4 );
+       iStatusBar->setFont(statusBarFont);
+       iStatusBar->setFixedHeight( 28 );
+       QPixmap pixmap(":ixonos_logo");
+       iStatusBar->setPixmap( pixmap );
+       iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );
 
        // Pegasus
        iDefaultRoomLabel
-                       = ToolBox::createLabel(aDefaultRoom->name(), importantTextFont);
-       iDefaultRoomLabel->setAlignment(Qt::AlignHCenter);
-       iDefaultRoomLabel->setHidden( true);
+                       = ToolBox::createLabel(aDefaultRoom->name(), textFont);
+       iDefaultRoomLabel->setAlignment( Qt::AlignHCenter );
+       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);
+       iStatusLabel = ToolBox::createLabel(tr( "is %1" ).arg(statusToText(aStatus) ), textFont);
+       iStatusLabel->setAlignment( Qt::AlignHCenter );
+       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();
+                       = ToolBox::createLabel(tr( "until %1" ).arg(aUntil.toString(iTimeFormat) ), textFont);
+       iUntilTextLabel->setAlignment( Qt::AlignHCenter );
+       iUntilTextLabel->setHidden( true );
+
+       QHBoxLayout *topLayout = new QHBoxLayout;
        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);
+
+       QVBoxLayout *textLayout = new QVBoxLayout;
+       textLayout->addWidget(iDefaultRoomLabel);
+       textLayout->addWidget(iStatusLabel);
+       textLayout->addWidget(iUntilTextLabel);
+       textLayout->addSpacing( 250 );
+
+       QHBoxLayout *centerLayout = new QHBoxLayout;
+       centerLayout->addLayout( textLayout );
+       centerLayout->addSpacing( 250 );
+
+       QHBoxLayout *bottomLayout = new QHBoxLayout;
+       bottomLayout->addSpacing( 56 );
+       bottomLayout->addWidget( iStatusBar );
+       bottomLayout->addSpacing( 56 );
+
+       QVBoxLayout *mainLayout = new QVBoxLayout;
+       mainLayout->addLayout( topLayout );
+       mainLayout->addSpacing( 50 );
+       mainLayout->addLayout( centerLayout );
+       mainLayout->addLayout( bottomLayout );
        setLayout(mainLayout);
 
        statusChanged(aStatus, aUntil);
@@ -95,6 +108,9 @@ RoomStatusIndicatorWidget::~RoomStatusIndicatorWidget()
 {
        delete iTimeDisplay;
        iTimeDisplay = 0;
+
+       delete iStatusBar;
+       iStatusBar = 0;
 }
 
 QString RoomStatusIndicatorWidget::statusToText(const Room::Status aStatus)
@@ -130,14 +146,14 @@ QPalette RoomStatusIndicatorWidget::createPalette(Room::Status aStatus)
 
        QPalette palette;
        palette.setColor( QPalette::Window, Qt::white );
-       palette.setColor( QPalette::WindowText, Qt::darkGray );
+       palette.setColor( QPalette::WindowText, Qt::black );
        palette.setBrush( QPalette::Window, brush );
        return palette;
 }
 
 void RoomStatusIndicatorWidget::setCurrentTime(QTime aCurrentTime)
 {
-       iTimeDisplay->setTime(aCurrentTime);
+       iTimeDisplay->setText( aCurrentTime.toString( iTimeFormat ) );
 }
 
 void RoomStatusIndicatorWidget::statusChanged(const Room::Status aStatus, const QTime aUntil)
@@ -164,11 +180,11 @@ bool RoomStatusIndicatorWidget::event(QEvent *event)
        switch (event->type())
        {
                case QEvent::Paint:
-                       qDebug() << "[RoomStatusIndicatorWidget::event] <Paint event>";
+                       //qDebug() << "[RoomStatusIndicatorWidget::event] <Paint event>";
                        break;
                case QEvent::PaletteChange:
-                       qDebug()
-                                       << "[RoomStatusIndicatorWidget::event] <Palette change event>";
+                       //qDebug()
+                       //              << "[RoomStatusIndicatorWidget::event] <Palette change event>";
                        break;
                default:
                        break;
@@ -192,11 +208,11 @@ void RoomStatusIndicatorWidget::connectionEstablished()
                qDebug() << "RoomStatusIndicatorWidget::connectionEstablished()";
        }
        ViewBase::connectionEstablished();
-       iConnectionLabel->setHidden( true);
+       iStatusBar->setText( tr("Connected"), BorderedBarWidget::LeftAlign );
 }
 
 void RoomStatusIndicatorWidget::connectionLost()
 {
        ViewBase::connectionLost();
-       iConnectionLabel->setHidden( false);
+       iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );
 }