mmsharing/livecommsui/lcui/src/lcvideowidget.cpp
changeset 22 496ad160a278
child 25 53c1c4459a94
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 //USER
       
    19 #include "lcvideowidget.h"
       
    20 
       
    21 //SYSTEM
       
    22 #include <QPainter>
       
    23 
       
    24 const qreal lcVideoWidgetCornerRounding = 10.0;
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 //
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 LcVideoWidget::LcVideoWidget(QGraphicsItem *parent, bool showVideo) :
       
    31     HbTransparentWindow(parent),
       
    32     mShowVideo(showVideo)
       
    33 {
       
    34 }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 LcVideoWidget::~LcVideoWidget()
       
    41 {
       
    42 }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void LcVideoWidget::paint(
       
    49         QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
       
    50 {
       
    51     Q_UNUSED(widget)
       
    52     
       
    53     if ( mShowVideo ){
       
    54 
       
    55         QPainter::CompositionMode origCompositionMode = painter->compositionMode();
       
    56         painter->setCompositionMode(QPainter::CompositionMode_Source);
       
    57         painter->setBrush(QColor(0,0,0,0));
       
    58         painter->drawRoundedRect( option->exposedRect, 
       
    59             lcVideoWidgetCornerRounding, lcVideoWidgetCornerRounding);
       
    60         
       
    61         painter->setCompositionMode(origCompositionMode); // restore
       
    62     } else {
       
    63         painter->setBrush(QColor(0,0,0,255));
       
    64         painter->drawRoundedRect( option->exposedRect, 
       
    65             lcVideoWidgetCornerRounding, lcVideoWidgetCornerRounding);
       
    66     }
       
    67 }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 void LcVideoWidget::setShowVideo(bool showVideo)
       
    74 {
       
    75     mShowVideo = showVideo;
       
    76 }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 bool LcVideoWidget::isShowingVideo()
       
    83 {
       
    84     return mShowVideo;
       
    85 }
       
    86 
       
    87 // End of file