1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qphononvideowidget.h" |
|
43 |
|
44 #include <QEvent> |
|
45 #include <QApplication> |
|
46 #include <QGridLayout> |
|
47 |
|
48 QPhononVideoWidget::QPhononVideoWidget(Phonon::VideoWidget *videoWidget, QObject *parent) |
|
49 :QVideoWidgetControl(parent), m_videoWidget(videoWidget), m_isFullscreen(false) |
|
50 { |
|
51 setAspectRatioMode(QVideoWidget::KeepAspectRatio); |
|
52 } |
|
53 |
|
54 QPhononVideoWidget::~QPhononVideoWidget() |
|
55 { |
|
56 } |
|
57 |
|
58 QVideoWidget::AspectRatioMode QPhononVideoWidget::aspectRatioMode() const |
|
59 { |
|
60 return m_aspectRatioMode; |
|
61 } |
|
62 |
|
63 void QPhononVideoWidget::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) |
|
64 { |
|
65 m_aspectRatioMode = mode; |
|
66 switch (mode) { |
|
67 case QVideoWidget::KeepAspectRatio: |
|
68 m_videoWidget->setAspectRatio(Phonon::VideoWidget::AspectRatioAuto); |
|
69 break; |
|
70 case QVideoWidget::IgnoreAspectRatio: |
|
71 m_videoWidget->setAspectRatio(Phonon::VideoWidget::AspectRatioWidget); |
|
72 break; |
|
73 default: |
|
74 m_videoWidget->setAspectRatio(Phonon::VideoWidget::AspectRatioAuto); |
|
75 } |
|
76 } |
|
77 |
|
78 bool QPhononVideoWidget::isFullScreen() const |
|
79 { |
|
80 return m_isFullscreen; |
|
81 } |
|
82 |
|
83 void QPhononVideoWidget::setFullScreen(bool fullScreen) |
|
84 { |
|
85 if (m_isFullscreen != fullScreen) { |
|
86 m_isFullscreen = fullScreen; |
|
87 emit fullScreenChanged(fullScreen); |
|
88 } |
|
89 } |
|
90 |
|
91 int QPhononVideoWidget::brightness() const |
|
92 { |
|
93 return qRound(100.0*m_videoWidget->brightness()); |
|
94 } |
|
95 |
|
96 void QPhononVideoWidget::setBrightness(int brightness) |
|
97 { |
|
98 m_videoWidget->setBrightness(brightness/100.0); |
|
99 emit brightnessChanged(brightness); |
|
100 } |
|
101 |
|
102 int QPhononVideoWidget::contrast() const |
|
103 { |
|
104 return qRound(100.0*m_videoWidget->contrast()); |
|
105 } |
|
106 |
|
107 void QPhononVideoWidget::setContrast(int contrast) |
|
108 { |
|
109 m_videoWidget->setContrast(contrast/100.0); |
|
110 emit contrastChanged(contrast); |
|
111 } |
|
112 |
|
113 int QPhononVideoWidget::hue() const |
|
114 { |
|
115 return qRound(100.0*m_videoWidget->hue()); |
|
116 } |
|
117 |
|
118 void QPhononVideoWidget::setHue(int hue) |
|
119 { |
|
120 m_videoWidget->setHue(hue/100.0); |
|
121 emit hueChanged(hue); |
|
122 } |
|
123 |
|
124 int QPhononVideoWidget::saturation() const |
|
125 { |
|
126 return qRound(100.0*m_videoWidget->saturation()); |
|
127 } |
|
128 |
|
129 void QPhononVideoWidget::setSaturation(int saturation) |
|
130 { |
|
131 m_videoWidget->setSaturation(saturation/100.0); |
|
132 emit saturationChanged(saturation); |
|
133 } |
|