1.0.6 candidate
[qtmeetings] / src / UserInterface / Views / WeeklyViewWidget.cpp
index 643732e..1596933 100644 (file)
@@ -16,6 +16,7 @@
 #include "ScheduleWidget.h"\r
 #include "ToolBox.h"\r
 #include "MeetingInfoDialog.h"\r
+#include "BorderedBarWidget.h"\r
 \r
 #include <QtDebug>\r
 \r
@@ -33,6 +34,20 @@ WeeklyViewWidget::WeeklyViewWidget( QDateTime aCurrentDateTime, Configuration *a
        regularTextFont.setBold( true );\r
        regularTextFont.setPointSize( 12 );\r
 \r
+       QFont clockFont;\r
+       clockFont.setStyleHint( QFont::Helvetica );\r
+       clockFont.setBold( true );\r
+       clockFont.setPixelSize( 36 );\r
+\r
+       QFont statusBarFont;\r
+       statusBarFont.setStyleHint( QFont::Helvetica );\r
+       statusBarFont.setPixelSize( 18 );\r
+\r
+       QFont buttonFont;\r
+       buttonFont.setStyleHint( QFont::Helvetica );\r
+       buttonFont.setBold( true );\r
+       buttonFont.setPixelSize( 18 );\r
+\r
        iSettingsButton = new QPushButton;\r
        iSettingsButton->setIcon( QPixmap( ":button_settings" ) );\r
        iSettingsButton->setFixedWidth( 36 );\r
@@ -41,57 +56,90 @@ WeeklyViewWidget::WeeklyViewWidget( QDateTime aCurrentDateTime, Configuration *a
        iCurrentDayLabel = ToolBox::createLabel( aCurrentDateTime.toString( iConfiguration->displaySettings()->dateFormat() ), regularTextFont );\r
        iCurrentWeekLabel = ToolBox::createLabel( tr( "Wk %1" ).arg( aCurrentDateTime.date().weekNumber() ), regularTextFont );\r
 \r
+       iTimeDisplay = new BorderedBarWidget( this );\r
+       iTimeDisplay->setFaceColor( Qt::darkGray );\r
+       iTimeDisplay->setBackgroundColor( Qt::white);\r
+       iTimeDisplay->setBorderWidth( 6 );\r
+       iTimeDisplay->setFixedWidth( 170 );\r
+       iTimeDisplay->setFixedHeight( 50 );\r
+       iTimeDisplay->setFont( clockFont );\r
+\r
        iRoomsCombo = new MeetingRoomCombo( iConfiguration->rooms(), this );\r
        iRoomsCombo->setCurrentRoom( iConfiguration->defaultRoom() );\r
        connect( iRoomsCombo, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( currentRoomChanged( Room * ) ) );\r
 \r
-       iTimeDisplay = new DigitalTimeDisplayWidget( aCurrentDateTime.time(), iConfiguration->displaySettings()->timeFormat(), this );\r
-       iTimeDisplay->setFrameVisible( false );\r
-       iTimeDisplay->setFont( regularTextFont );\r
+       iStatusBar = new BorderedBarWidget( this );\r
+       iStatusBar->setFaceColor( Qt::darkGray );\r
+       iStatusBar->setBackgroundColor( Qt::white );\r
+       iStatusBar->setBorderWidth( 4 );\r
+       iStatusBar->setFont(statusBarFont);\r
+       iStatusBar->setFixedHeight( 36 );\r
+       iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );\r
+\r
+       connect( iStatusBar, SIGNAL( clicked() ), this, SIGNAL( refreshButtonClicked() ) );\r
 \r
        iSchedule = new ScheduleWidget( aCurrentDateTime, iConfiguration->displaySettings(), this );\r
        connect( iSchedule, SIGNAL( shownWeekChanged( QDate ) ), this, SIGNAL( shownWeekChanged( QDate ) ) );\r
        connect( iSchedule, SIGNAL( meetingActivated( Meeting* ) ), this, SIGNAL( meetingActivated( Meeting* ) ) );\r
 \r
        iPreviousWeekButton = new QPushButton( this );\r
-       iPreviousWeekButton->setText( tr( "<<" ) );\r
-       iPreviousWeekButton->setFixedWidth( 60 );\r
+       iPreviousWeekButton->setText( tr( "<" ) );\r
+       iPreviousWeekButton->setFixedWidth( 50 );\r
+       iPreviousWeekButton->setFixedHeight( 100 );\r
+       iPreviousWeekButton->setFont( buttonFont );\r
        connect( iPreviousWeekButton, SIGNAL( clicked() ), iSchedule, SLOT( showPreviousWeek() ) );\r
 \r
        iCurrentWeekButton = new QPushButton( this );\r
        iCurrentWeekButton->setFixedWidth( 100 );\r
-       iCurrentWeekButton->setText( tr( "Current" ) );\r
+       iCurrentWeekButton->setFixedHeight( 46 );\r
+       iCurrentWeekButton->setText( tr( "Today" ) );\r
+       iCurrentWeekButton->setFont( buttonFont );\r
+\r
        connect( iCurrentWeekButton, SIGNAL( clicked() ), iSchedule, SLOT( showCurrentWeek() ) );\r
 \r
        iNextWeekButton = new QPushButton( this );\r
-       iNextWeekButton->setFixedWidth( 60 );\r
-       iNextWeekButton->setText( tr( ">>" ) );\r
+       iNextWeekButton->setFixedWidth( 50 );\r
+       iNextWeekButton->setFixedHeight( 100 );\r
+       iNextWeekButton->setText( tr( ">" ) );\r
+       iNextWeekButton->setFont( buttonFont );\r
        connect( iNextWeekButton, SIGNAL( clicked() ), iSchedule, SLOT( showNextWeek() ) );\r
 \r
        // **********************************\r
        //              Create the view's layout\r
+       QVBoxLayout *leftLayout = new QVBoxLayout;\r
+       QVBoxLayout *centerLayout = new QVBoxLayout;\r
+       QVBoxLayout *rightLayout = new QVBoxLayout;\r
+\r
+       leftLayout->addWidget( iPreviousWeekButton );\r
+       rightLayout->addWidget( iNextWeekButton );\r
+\r
        QHBoxLayout *tableLayout = new QHBoxLayout;\r
        tableLayout->addWidget( iSchedule );\r
 \r
-       QHBoxLayout *bottomLayout = new QHBoxLayout;\r
-       bottomLayout->addWidget( iRoomsCombo );\r
-       bottomLayout->addWidget( iTimeDisplay );\r
-       QVBoxLayout *dateLayout = new QVBoxLayout;\r
-       dateLayout->addWidget( iCurrentDayLabel );\r
-       dateLayout->addWidget( iCurrentWeekLabel );\r
-       bottomLayout->addLayout( dateLayout );\r
-       bottomLayout->addWidget( iPreviousWeekButton );\r
-       bottomLayout->addWidget( iCurrentWeekButton );\r
-       bottomLayout->addWidget( iNextWeekButton );\r
-       bottomLayout->addWidget( iSettingsButton );\r
-\r
-       QVBoxLayout *mainLayout = new QVBoxLayout;\r
-       mainLayout->addLayout( tableLayout );\r
-       mainLayout->addLayout( bottomLayout );\r
+       QGridLayout *naviLayout = new QGridLayout;\r
+       naviLayout->addWidget( iCurrentWeekButton, 0, 0, Qt::AlignLeft );\r
+       naviLayout->addWidget( iTimeDisplay, 0, 1, Qt::AlignCenter );\r
+       naviLayout->addWidget( iRoomsCombo, 0, 2, Qt::AlignRight );\r
+\r
+//     QVBoxLayout *dateLayout = new QVBoxLayout;\r
+//     dateLayout->addWidget( iCurrentDayLabel );\r
+//     dateLayout->addWidget( iCurrentWeekLabel );\r
+//     bottomLayout->addLayout( dateLayout );\r
+//     bottomLayout->addWidget( iSettingsButton );\r
+\r
+       centerLayout->addLayout( naviLayout );\r
+       centerLayout->addLayout( tableLayout );\r
+       centerLayout->addWidget( iStatusBar );\r
+\r
+       QHBoxLayout *mainLayout = new QHBoxLayout;\r
+       mainLayout->addLayout( leftLayout );\r
+       mainLayout->addLayout( centerLayout );\r
+       mainLayout->addLayout( rightLayout );\r
        setLayout( mainLayout );\r
        \r
        // Set child observing\r
        observeChild( iRoomsCombo );\r
+       observeChild( iStatusBar );\r
        observeChild( iTimeDisplay );\r
        observeChild( iCurrentDayLabel );\r
        observeChild( iCurrentWeekLabel );\r
@@ -102,7 +150,7 @@ WeeklyViewWidget::WeeklyViewWidget( QDateTime aCurrentDateTime, Configuration *a
 \r
        QPalette palette;\r
        palette.setColor( QPalette::Window, Qt::white );\r
-       palette.setColor( QPalette::WindowText, Qt::darkGray );\r
+       palette.setColor( QPalette::Foreground, Qt::darkGray );\r
        setPalette( palette );\r
 \r
        setAutoFillBackground( true );\r
@@ -132,6 +180,12 @@ WeeklyViewWidget::~WeeklyViewWidget()
                delete iTimeDisplay;\r
                iTimeDisplay = 0;\r
        }\r
+       if ( iStatusBar )\r
+       {\r
+               delete iStatusBar;\r
+               iStatusBar = 0;\r
+       }\r
+\r
        if ( iSchedule )\r
        {\r
                delete iSchedule;\r
@@ -174,15 +228,32 @@ Room* WeeklyViewWidget::currentRoom()
        return iRoomsCombo->currentRoom();\r
 }\r
 \r
-void WeeklyViewWidget::setCurrentDateTime( QDateTime aCurrentDateTime )\r
+void WeeklyViewWidget::setConnectionStatus( QDateTime aCurrentTime, bool aConnected,\r
+               QTime aLastUpdated, QString aError )\r
 {\r
-       iCurrentDayLabel->setText( aCurrentDateTime.date().toString( iConfiguration->displaySettings()->dateFormat() ) );\r
+       iCurrentDayLabel->setText( aCurrentTime.date().toString( iConfiguration->displaySettings()->dateFormat() ) );\r
+       iCurrentWeekLabel->setText( tr( "Wk %1" ).arg( aCurrentTime.date().weekNumber() ) );\r
+       iSchedule->setCurrentDateTime( aCurrentTime );\r
        \r
-       iCurrentWeekLabel->setText( tr( "Wk %1" ).arg( aCurrentDateTime.date().weekNumber() ) );\r
-\r
-       iTimeDisplay->setTime( aCurrentDateTime.time() );\r
+       iTimeDisplay->setText( aCurrentTime.toString( iConfiguration->displaySettings()->timeFormat() ) );\r
+       if ( aLastUpdated.isNull() )\r
+               iStatusBar->setText( tr("Disconnected") , BorderedBarWidget::LeftAlign );\r
+       else if ( !aConnected )\r
+       {\r
+               iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );\r
+       }\r
+       else\r
+       {\r
+               iStatusBar->setText( tr("Connected - Last update %1")\r
+                               .arg(aLastUpdated.toString(iConfiguration->displaySettings()->timeFormat())) ,\r
+                               BorderedBarWidget::LeftAlign );\r
+       }\r
+       showError( aError );\r
+ }\r
 \r
-       iSchedule->setCurrentDateTime( aCurrentDateTime );\r
+void WeeklyViewWidget::showError( QString aError )\r
+{\r
+       iStatusBar->setText( aError );\r
 }\r
 \r
 QDate WeeklyViewWidget::beginnigOfShownWeek()\r
@@ -205,3 +276,13 @@ void WeeklyViewWidget::setDefaultRoom()
 {\r
        iRoomsCombo->setCurrentRoom( iConfiguration->defaultRoom() );\r
 }\r
+\r
+void WeeklyViewWidget::connectionEstablished()\r
+{\r
+       ViewBase::connectionEstablished();\r
+}\r
+\r
+void WeeklyViewWidget::connectionLost()\r
+{\r
+       ViewBase::connectionLost();\r
+}\r