X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2FUserInterface%2FComponents%2FScheduleWidget.cpp;fp=src%2FUserInterface%2FComponents%2FScheduleWidget.cpp;h=181593e358ebc6500a5dc62a8c93cb0c4b0c77e7;hb=031dfbe58e5265dfff05b8ceb7ffae21be7c4868;hp=65ca3535d2631dd4fb85b254601ab2835961c882;hpb=51d64b3d9f4cacc447c74e5811e692fbe9b4137f;p=qtmeetings diff --git a/src/UserInterface/Components/ScheduleWidget.cpp b/src/UserInterface/Components/ScheduleWidget.cpp index 65ca353..181593e 100644 --- a/src/UserInterface/Components/ScheduleWidget.cpp +++ b/src/UserInterface/Components/ScheduleWidget.cpp @@ -12,6 +12,8 @@ const QColor ScheduleWidget::sFreeBackground = QColor( Qt::white ); const QColor ScheduleWidget::sBusyBackground = QColor( 238, 147, 17 ); const QColor ScheduleWidget::sBusyBackgroundStart = QColor( 254, 193, 104 ); +const QColor ScheduleWidget::sCurrentBackgroundStart = QColor( 237, 124, 125 ); +const QColor ScheduleWidget::sCurrentBackground = QColor( 161, 1, 1 ); const QColor ScheduleWidget::sHeaderBackground = QColor( Qt::white ); const QColor ScheduleWidget::sDayHighlightColor = QColor( 255, 235, 160 ); const QColor ScheduleWidget::sTimeHighlightColor = QColor( Qt::black ); @@ -104,8 +106,18 @@ void ScheduleTableWidget::paintEvent( QPaintEvent* aEvent ) for ( int i = 0; i < iMeetingsByDay[day].size(); ++i ) { QLinearGradient linearGrad( QPoint(iMeetingsByDay[day][i].rect.x(),iMeetingsByDay[day][i].rect.y()) , QPoint(iMeetingsByDay[day][i].rect.x(),iMeetingsByDay[day][i].rect.bottom()) ); - linearGrad.setColorAt(0, ScheduleWidget::sBusyBackgroundStart); - linearGrad.setColorAt(1, ScheduleWidget::sBusyBackground); + // draw meeting with red if it is ongoing + if ( iMeetingsByDay[day][i].meeting->startsAt() <= QDateTime::currentDateTime() && + iMeetingsByDay[day][i].meeting->endsAt() >= QDateTime::currentDateTime() ) + { + linearGrad.setColorAt(0, ScheduleWidget::sCurrentBackgroundStart); + linearGrad.setColorAt(1, ScheduleWidget::sCurrentBackground); + } + else + { + linearGrad.setColorAt(0, ScheduleWidget::sBusyBackgroundStart); + linearGrad.setColorAt(1, ScheduleWidget::sBusyBackground); + } painter.setBrush(linearGrad); painter.drawRoundRect( iMeetingsByDay[day][i].rect, 20, 20 ); @@ -299,7 +311,9 @@ ScheduleWidget::ScheduleWidget( QDateTime aCurrentDateTime, DisplaySettings *aSe iScheduleTable->setShowGrid( false ); QFont font; - font.setPointSize( 10 ); + font.setStyleHint( QFont::Helvetica ); + font.setBold( true ); + font.setPixelSize( 20 ); // add empty item to top-left corner, this will be updated in refresh() QTableWidgetItem *weekItem = new QTableWidgetItem(); @@ -374,7 +388,7 @@ void ScheduleWidget::refresh() item->setText( tr( "Wk %1" ).arg( iShownDate.weekNumber() ) ); continue; } - item->setText( iShownDate.addDays( i - 1 ).toString( tr( "ddd d MMM" ) ) ); + item->setText( iShownDate.addDays( i - 1 ).toString( tr( "ddd d/M" ) ) ); if ( iCurrentDateTime.date() == iShownDate.addDays( i - 1 ) ) { @@ -454,10 +468,10 @@ int ScheduleWidget::weekLengthAsDays() void ScheduleWidget::resizeEvent( QResizeEvent* /* aEvent */ ) { QRect rect = iScheduleTable->contentsRect(); - int rowHeight = ( int )( rect.height() / ( float )iScheduleTable->rowCount() ); - int headerRowHeight = rowHeight; - int columnWidth = ( int )( rect.width() / ( iScheduleTable->columnCount() - 0.5f ) ); - int headerColumnWidth = columnWidth / 2; + int rowHeight = ( int )( rect.height() / ( float )( iScheduleTable->rowCount() + 1 ) ); + int headerRowHeight = ( int )rowHeight*2; + int headerColumnWidth = rect.width() * 0.15f; + int columnWidth = ( rect.width() - headerColumnWidth ) / ( iScheduleTable->columnCount() - 1 ); iScheduleTable->setRowHeight( 0, headerRowHeight ); for ( int i = 1; i < iScheduleTable->rowCount(); ++i ) @@ -474,6 +488,7 @@ void ScheduleWidget::resizeEvent( QResizeEvent* /* aEvent */ ) // resize table so that frame size matches exactly int leftMargin = 0, topMargin = 0, rightMargin = 0, bottomMargin = 0; iScheduleTable->getContentsMargins( &leftMargin, &topMargin, &rightMargin, &bottomMargin ); - iScheduleTable->resize( columnWidth * iScheduleTable->columnCount() - headerColumnWidth + leftMargin + rightMargin, - rowHeight * iScheduleTable->rowCount() + topMargin + bottomMargin ); + iScheduleTable->resize( columnWidth * ( iScheduleTable->columnCount() - 1 ) + + headerColumnWidth + leftMargin + rightMargin, + rowHeight * ( iScheduleTable->rowCount() + 1 ) + topMargin + bottomMargin ); }