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 if ( mShowVideo ){ |
|
53 QPainter::CompositionMode origCompositionMode = painter->compositionMode(); |
|
54 QPoint point(10,10); |
|
55 QString str = QString::fromAscii("Playing..."); |
|
56 if( mLocalPlayer ){ |
|
57 painter->setBrush( Qt::red ); |
|
58 }else{ |
|
59 painter->setBrush( Qt::green ); |
|
60 } |
|
61 painter->setPen( Qt::white ); |
|
62 painter->drawRoundedRect( option->exposedRect, |
|
63 lcVideoWidgetCornerRounding, lcVideoWidgetCornerRounding); |
|
64 painter->drawText(option->exposedRect.center(),str); |
|
65 painter->setCompositionMode(origCompositionMode); // restore |
|
66 } else { |
|
67 painter->setBrush(QColor(0,0,0,255)); |
|
68 painter->drawRoundedRect( option->exposedRect, |
|
69 lcVideoWidgetCornerRounding, lcVideoWidgetCornerRounding); |
|
70 } |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void LcVideoWidget::setShowVideo(bool showVideo) |
|
78 { |
|
79 mShowVideo = showVideo; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 bool LcVideoWidget::isShowingVideo() |
|
87 { |
|
88 return mShowVideo; |
|
89 } |
|
90 |
|
91 // End of file |
|