User interface update
[qtmeetings] / src / UserInterface / Views / WeeklyViewWidget.cpp
index 773ecfe..6c8b75c 100644 (file)
 #include "ScheduleWidget.h"\r
 #include "ToolBox.h"\r
 #include "MeetingInfoDialog.h"\r
+#include "BorderedBarWidget.h"\r
 \r
 #include <QtDebug>\r
 \r
 WeeklyViewWidget::WeeklyViewWidget( QDateTime aCurrentDateTime, Configuration *aConfiguration, QWidget *aParent ) :\r
-               ObservedWidget( aParent ), iConfiguration( aConfiguration )\r
+               ViewBase( ViewBase::NormalView, aParent ), iConfiguration( aConfiguration )\r
 {\r
 \r
        // *****************************************\r
@@ -33,78 +34,134 @@ 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( 12 );\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
-       connect( iSettingsButton, SIGNAL( clicked() ), this, SIGNAL( showSettingsView() ) );\r
+       connect( iSettingsButton, SIGNAL( clicked() ), this, SIGNAL( settingsButtonClicked() ) );\r
 \r
        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( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );\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
-       connect( iTimeDisplay, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );\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( 28 );\r
+       QPixmap pixmap(":ixonos_logo");\r
+       iStatusBar->setPixmap( pixmap );\r
 \r
        iSchedule = new ScheduleWidget( aCurrentDateTime, iConfiguration->displaySettings(), this );\r
        connect( iSchedule, SIGNAL( shownWeekChanged( QDate ) ), this, SIGNAL( shownWeekChanged( QDate ) ) );\r
-       connect( iSchedule, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );\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
+       observeChild( iPreviousWeekButton );\r
+       observeChild( iCurrentWeekButton );\r
+       observeChild( iNextWeekButton );\r
+       observeChild( iSettingsButton );\r
 \r
        QPalette palette;\r
        palette.setColor( QPalette::Window, Qt::white );\r
        palette.setColor( QPalette::Foreground, Qt::darkGray );\r
        setPalette( palette );\r
 \r
+       setAutoFillBackground( true );\r
+\r
        // ******************************************\r
        //              Handle all the signal connections\r
        // TODO : this solution if interaction monitoring is not elegant enough\r
-       connect( iPreviousWeekButton, SIGNAL( clicked() ), this, SIGNAL( observedEventDetected() ) );\r
-       connect( iCurrentWeekButton, SIGNAL( clicked() ), this, SIGNAL( observedEventDetected() ) );\r
-       connect( iNextWeekButton, SIGNAL( clicked() ), this, SIGNAL( observedEventDetected() ) );\r
-       connect( iRoomsCombo, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( observedEventDetected() ) );\r
-       connect( iRoomsCombo, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( observedEventDetected() ) );\r
+//     connect( iPreviousWeekButton, SIGNAL( clicked() ), this, SIGNAL( observedEventDetected() ) );\r
+//     connect( iCurrentWeekButton, SIGNAL( clicked() ), this, SIGNAL( observedEventDetected() ) );\r
+//     connect( iNextWeekButton, SIGNAL( clicked() ), this, SIGNAL( observedEventDetected() ) );\r
+//     connect( iRoomsCombo, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( observedEventDetected() ) );\r
+//     connect( iRoomsCombo, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( observedEventDetected() ) );\r
        // TODO: connect RoomCombo signals to change meetings data.\r
        connect( iRoomsCombo, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( currentRoomChanged( Room * ) ) );\r
        connect( iRoomsCombo, SIGNAL( currentRoomChanged( Room * ) ), iSchedule, SLOT( refresh() ) );\r
@@ -122,6 +179,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
@@ -170,7 +233,7 @@ void WeeklyViewWidget::setCurrentDateTime( QDateTime aCurrentDateTime )
        \r
        iCurrentWeekLabel->setText( tr( "Wk %1" ).arg( aCurrentDateTime.date().weekNumber() ) );\r
 \r
-       iTimeDisplay->setTime( aCurrentDateTime.time() );\r
+       iTimeDisplay->setText( aCurrentDateTime.toString( iConfiguration->displaySettings()->timeFormat() ) );\r
 \r
        iSchedule->setCurrentDateTime( aCurrentDateTime );\r
 }\r
@@ -185,3 +248,26 @@ void WeeklyViewWidget::refreshMeetings( const QList<Meeting*> &aMeetings )
        qDebug() << "WeeklyViewWidget::refreshMeetings()";\r
        iSchedule->refreshMeetings( aMeetings );\r
 }\r
+\r
+void WeeklyViewWidget::showCurrentWeek()\r
+{\r
+       iSchedule->showCurrentWeek();\r
+}\r
+\r
+void WeeklyViewWidget::setDefaultRoom()\r
+{\r
+       iRoomsCombo->setCurrentRoom( iConfiguration->defaultRoom() );\r
+}\r
+\r
+void WeeklyViewWidget::connectionEstablished()\r
+{\r
+       ViewBase::connectionEstablished();\r
+       qDebug() << "WeeklyViewWidget::connectionEstablished";\r
+       iStatusBar->setText( tr("Connected"), BorderedBarWidget::LeftAlign );\r
+}\r
+\r
+void WeeklyViewWidget::connectionLost()\r
+{\r
+       ViewBase::connectionLost();\r
+       iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );\r
+}\r