2 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #include "HTML5VideoWidget.h"
23 HTML5VideoWidget::HTML5VideoWidget(QWidget *parent)
24 : QVideoWidget(parent)
25 , m_overlayWidget(new OverlayWidget(this))
27 connect(m_overlayWidget, SIGNAL(controlClicked(bool)), this, SLOT(onControlClicked(bool)));
28 connect(m_overlayWidget, SIGNAL(sliderMoved(int)), this, SLOT(onSliderMoved(int)));
29 connect(m_overlayWidget, SIGNAL(closeClicked()), this, SLOT(onCloseClicked()));
30 connect(m_overlayWidget, SIGNAL(muted(bool)), this, SIGNAL(muted(bool)));
31 connect(m_overlayWidget, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int)));
32 m_overlayWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
35 void HTML5VideoWidget::setDuration(qint64 duration)
37 m_overlayWidget->setDuration(duration / 1000);
40 void HTML5VideoWidget::mousePressEvent(QMouseEvent *)
42 m_overlayWidget->showFullScreen();
45 void HTML5VideoWidget::onPlayerStopped()
47 m_overlayWidget->onPlayerStopped();
50 void HTML5VideoWidget::onPlayerError()
52 m_overlayWidget->onPlayerError();
55 void HTML5VideoWidget::onEndOfMedia()
57 m_overlayWidget->onEndOfMedia();
60 void HTML5VideoWidget::onBufferingMedia()
62 m_overlayWidget->onBufferingMedia();
65 void HTML5VideoWidget::onBufferedMedia()
67 m_overlayWidget->onBufferedMedia();
70 void HTML5VideoWidget::onControlClicked(bool isPaused)
78 void HTML5VideoWidget::onPositionChanged(qint64 position)
80 m_overlayWidget->setPosition(position / 1000);
83 void HTML5VideoWidget::onSliderMoved(int value)
85 emit positionChangedByUser(((qint64)value)*1000);
88 void HTML5VideoWidget::onCloseClicked()
94 void HTML5VideoWidget::showFullScreen()
97 m_overlayWidget->showFullScreen();
100 void HTML5VideoWidget::setVolume(int volume)
102 m_overlayWidget->setVolume(volume);